Internationalization

Internationalization can be a tedious task for your application and even more so for your emails Learn how to simplify the process

How it works?

The i18n works similar to what you are used to The patterns are similar to on Next-intl

Default language

You can set a default language. If a default language is configured and you omit the language parameter when you call, or if the specified language is not available, the system will use the default language.

If no default language is set, the system will use the language specified when you call. If that language is not available, no translation file will be applied.

Translations file

You can add a language in the template editor in your dashboard Once the language is added, you can edit the translation file.

The expected format is JSON

Basic

{
  "hello": "Hello",
}

Advanced

{
  "hello": "Hello { user.firstname }",
}

Use translation

Basic

<h1>{{ t('hello') }}</h1>
Output
<h1>Hello</h1>

Advanced

<h1>{{ t('hello', { user: { firstname: 'John' } }) }}</h1>
Output
<h1>Hello John</h1>

Utiliser les variables de la template

Variables
{
  "user": {
    "name": "John"
  }
}
h1>{{ t('hello', { firstname: page.user.firstname }) }}</h1>
Output
<h1>Hello John</h1>

Full demo

Last updated