Localizing Widget Template Settings
You can localize widget template settings to the provided language translations using the internationalization (i18n) system.
This article explains how to localize your widget template settings and provides a practical example of how to map settings to translations.
Mapping settings to translations
The widget template schema uses the i18n.{SettingName} internationalization format within labels to map settings to translation files. i18n’s interpolation functionality makes it possible to integrate dynamic values into translations.
You can localize your widget template settings by defining translations in the schema_translations property of the widget template schema.
Localization example
The following example demonstrates how to add translations for the widget template settings using the schema_translations property.
- Identify all settings that need a translation. Each
labelvalue must start with thei18n.prefix. For example,"label": "i18n.LineColor". - Prepare your schema translations JSON object. It must contain a default language code along with the other languages you want to support formatted by two lowercase letters, a dash, and at least two alphanumeric characters. For more information, see the Supported language code schemes section below.
- Stringify your data structure. You will pass it as a value to
schema_translationsin the next step.
- Create a widget template by sending a
POSTrequest to the Create a Widget Template endpoint. The following example creates a simple text widget:
-
From the control panel, open Page Builder and locate your newly created widget template.
-
Drag and drop the widget in a region on a page to test it out.

-
Change your store’s language settings. You can do so in the control panel by going to My Profile > Edit Profile. For this example, we are going to set the language to French.
-
Return to Page Builder and test the widget again. The display language should now be French.

Supported language code schemes
Widget templates support both ISO 639‑1 and IETF language tag code schemes. The language code must follow a set format of two lowercase letters for a two-letter code system or two lowercase letters, a dash, and at least two alphanumeric characters for a multiple-character code system.
- Translations must start with the
i18n.prefix. - Language code must contain a default value.
- You can reuse translations within the widget template schema, but translations within the
schema_translations.jsonfile must be unique.