Use this app to integrate your Lokalise project with Braze.

Index

Getting started

First of all, prepare your translations on Lokalise as usual. For example, let's create a simple translation key description:

If you haven't already done so, open your Braze dashboard and proceed to Users > User import. Here you can import your users as explained in Braze documentation. When preparing a CSV file for importing, make sure to include a language column with users' languages. We will use this language field later when displaying translations.

Configuring Braze app

Now let's return to Lokalise, open your project, and click Apps. Here search for Braze app, click on it and then press Install.

You are going to see the following screen:

We will need the Translation files URL in a few minutes when configurting Braze campaign. You can generate a new URL by clicking Refresh.

To test that this URL works correctly, just copy it, replace {language} with a language code (for example, en) and open this URL in your browser. You will see a JSON file with your keys and translations:

That's it!

Using translations in Braze campaign

When you are ready, return to Braze and proceed to Campaigns. Open an existing campaign or create a new one. For the purposes of this article, we'll create a new Email campaign with some sample content.

Cick Edit Email Body:

You will see your email's HTML markup which utilizes Liquid template language.

Now find the place where you would like to utilize your translations and insert the following markup:

{% connected_content https://exports.live.lokalise.cloud/braze/123abc/456xyz/{{${language}}}.json :save translations %}

Replace the https://exports.live.lokalise.cloud/... URL with the one fetched in the previous step.

  • {{${language}}} means "insert user language on this position". Alternatively, you can hardcode your language code, for example en.json.

    • Note: To ensure that the appropriate translated JSON file is retrieved for each user, you must place either the {{${language}}} profile attribute or another similar custom attribute that holds the user’s language at the end of the translation files URL. E.g., /{{${language}}}.json. The values held in these attributes must match the prefix of each of the translated JSON files. This will ensure the correct translation file is returned for each user.

  • :save translations is going to save the JSON content under translations variable.

Now simply use the translations variable to display the desired translations by their keys.

For example, to display the description key you would say:

{{ translations.description }}

Now simply save the email template and preview it. You should see your translation being displayed:

Did this answer your question?