Translating Regions
Themes now support translations for a specific region, which localizes the region name within Page Builder. Within the region HTML, we can now add a translation field to point to the correct localization from schema_translations.json.
Translating regions example
In this example, we will translate several regions on the home page. The following code sample contains translated fields that localize the layers pane within PageBuilder.
- Add
translationfields to the home page (/templates/pages/home.html).
- Translation must follow prefix “i18n.RegionName.”
- You can only add a translation field to a
{{{ region }}}field.
home.html
- Add region translations to the
schema_translations.jsonfile.
- Region translations must live within the
schema_translations.jsonfile. - Language code must contain a default value.
- Language code outside of default will support two character language code as well as multiple character language code (which is formatted by two lowercase letters, a dash, and at least two alphanumeric characters after). Example provided below:
- Example of two character language code “en”, “fr”, “uk”, “zh”.
- Example of multiple character language code “fr-FR”, “zh-CN”, “en-US”, “uk-UA”, “es-419”.
schemaTranslations.json
- Change the language in the control panel settings to view the translated regions. Go to
My Profile > Edit Profile > Preferred language.
