The feature is only available for Novu Cloud users with Business or Enterprise plans.

Introduction

The Translation Management feature allows you to seamlessly adapt your workflows to different languages and automatically apply them based on your customers’ locales. It enhances engagement, personalizes the user experience, and allows you to expand your market reach.

To understand how Translation Management works in Novu we need to review its main pillars:

  • Translation Groups
  • Translation Files
  • Localized Message Content
  • Subscribers locale

Translation Groups

Translation Group allows you to efficiently manage translations for diverse languages with shared business significance. For example, the Branding translation group can hold the content related to your company identity, while the Marketing translation group can exclusively house content related to your marketing campaigns. You aren’t obligated to divide your translation content, you can manage it all within a single translation group.

To create the Translation Group navigate to the Translations page from the main navigation and click on the “Add group” button.

Before creating your first Translation Group you’ll be prompted to specify the default locale for organization. This locale serves as a fallback option for localized messages in cases where the recipient hasn’t defined a specific locale.

After selecting the default language, you can provide the essential details: the group name, group identifier, and select your target languages.

The group identifier is an important value that you will later use in the editor to localize your messages. This is a similar concept that we use across the app to identify the main parts.

After the group is created, you will land on the group details page on which you can see the list with the empty translations for the languages you choose.

Translations

Translations are JSON files that contain the content of your messages in a specific language. For example, if you created a Marketing translation group with two target languages English and German, then your translation JSON files might look like this:

English (en.json):

{
  "welcome_message": "Welcome to our Marketing Campaign!",
  "learn_more": "Learn More",
  "special_offer": "Special Offer",
  "contact_us": "Contact Us"
}

German (de.json):

{
  "welcome_message": "Willkommen bei unserer Marketingkampagne!",
  "learn_more": "Mehr erfahren",
  "special_offer": "Sonderangebot",
  "contact_us": "Kontaktieren Sie uns"
}

To upload your translations click on the “Upload files” button located at the top of the Translation Group details page.

Select the translation files and click “Open” button.

With each uploaded translation file, you must indicate the language it references. Additionally, you can verify the correctness of the uploaded file by previewing its contents.

Click on “Upload files” button. Congratulations you just uploaded the translation files and created the translation group! 🎉

Localized Message Content

To localize your message content, you need to use the translation variables in the editor. The variables allow you to reference the values from the translation files. It consists of the i18n handlebar helper and path to the translated value.

Let’s take a look at the example: {{i18n "marketing.welcome_message"}}.

  • i18n is the handlebar helper that tells Novu that you would like to use the Translations
  • "marketing.welcome_message" is the path that is composed of the Translation Group identifier marketing and translation JSON file key welcome_message
i18n variables can be used in subject and preheader fields of the email step.

Subscribers Locale

The subscribers locale defines in which language the message should be delivered to that recipient. When the locale is not specified it will fallback to the default locale set for the organization. The locale format includes ISO language plus the region, for example de_DE language German and region Germany.

To update the locale you can use Novu API or any of our SDKs, more information can be found here.

Editor Examples

Variables

It is possible to include variables in your translation strings, they should be wrapped in double curly brackets. Their value could be set as a string or as a variable - either a system variable or a variable sent through the payload.

{
  "withVariables": "Welcome {{name}} to {{organization}}"
}

In the editor:

{{i18n "welcome.withVariables" name=subscriber.firstName organization="Novu"}}

Context

By providing a context you can differ translations. Eg. useful to provide gender specific translations.

For example:

{
	"friend": "A friend",
	"friend_male": "A boyfriend",
	"friend_female": "A girlfriend"
}

In the editor:

{{i18n "welcome.friend" context="male"}}

Will result in the message A boyfriend. Not adding any context will output A friend.

Plurals

To distinguish between plural translation options.

{
	"keyWithCount": "{{count}} item",
	"keyWithCount_plural": "{{count}} items",
}

In the editor:

{{i18n "welcome.keyWithCount" count=7}}

Will result in 7 items

Date formats

To control date formats, do as follows:

{
  "date": "Current date: {{date, dd/MM/yyyy}}",
  "try_date": "Current date: {{date, MM/dd/yyyy}}",
  "intlDateTime": "On the {{date, HH:yyyy}}"
}

In the editor:

Date can be a string or a variable you send in the payload as { date: new Date() }

{{i18n "welcome.date" date="12-06-2023"}}
{{i18n "welcome.try_date" date=date}}
{{i18n "welcome.intlDateTime" date=date}}