Skip to main content

Locales

Locales allow you to customize elements based on the the locale of the target recipient.

At the moment locales is restricted to elements that have a content property. This includes action, quote, and text elements.

Locales take the following interface:

interface Locales {
[locale: string]: {
content: string;
};
}

When a "locale" is specified in the message.to field, each element that has content for that "locale" will have their top level content property replaced by the locale specific content.

{
"message": {
"to": {
"email": "person@example.com",
"locale": "eu-fr"
},
"content": {
"version": "2022-01-01",
"elements": [
{
"type": "text",
"content": "Hello",
"locales": {
"eu-fr": {
"content": "Bonjour"
}
}
}
]
}
}
}

In the above example, Hello would be replaced with Bonjour.

Was this helpful?