Internationalization of Notification Content
How to send multi-language notifications with Courier.
There are multiple ways to internationalize your notifications with Courier. The best option for your use case depends on the number of languages you support and the complexity of your notification templates.
Multi-language Internationalization Models for Notifications
Multiple Channels, One Template
In this model (one channel per language), the logic defining which notification to fire lives in Courier under the channel settings as send conditions. This model works well for single-channel notifications or multi-channel notifications when you support just a few languages. Notifications templates can get large and complex when you have multiple channel types (email, SMS, DM, push) and support many languages. If this is true for your use case, consider using the multiple templates (one per language) model for internationalization.
To use this internationalization model, you'll need to use:
- Channel-level conditionals
- Profile data either sent as part of the send command profile object or stored in Courier as part of a recipient profile
Steps
- Store a "locale" property on each user profile inside of Courier, with ISO 639-1 language code values like
en-us
,en
,fr
,fr-be
,fr-ca
, etc. (or include it as part of the send command data payload). - Add a channel for each language to your template:
- Set up a conditional to match the corresponding language:
Multiple Templates
In this internationalization model (one template per language), the logic defining which notification to fire lives in your system rather than within Courier. This model is best for multi-channel notifications when you support many languages.
To implement this internationalization model:
- Create a notification template for each language you support (i.e., five supported languages = five versions of the same notification).
- Map a unique language-based event to each template.
- Trigger the language-specific event to send the notification to users with that.
Pull Translated Content From the Data Payload
To use this (one template) method, you will need to send the translated content as part of the data payload and pull it into the content block(s) in the notification template with Variables or handlebars code.
- Translate the content and store it in your backend
- Include the translated content in the JSON data object of the Send event
- Pull the translated content into the notification template from the Send event data payload using variables.
Template Using Variables
Test Event With Variable Values
Preview Your Language-Specific Template With Values Pulled From Variables
Internationalization Specification
Courier Business customers have access to Internationalization Specification features.
Formatting Emails
For more information on formatting dates and numbers within an email, see Handlebars Use Cases