Overview
Locale files are JSON files that contain a set of translations for text strings used throughout the theme.
In addition to giving merchants a single place to easily edit words and phrases that are repeated throughout the theme, locale files allow you to translate storefront content to multiple languages for international merchants and customers.
Location
Locale files are located in the locales
directory of the theme:
└── theme
...
└── locales
Subtypes
There is one type of locale file:
Type | Description |
---|---|
Storefront | Storefront locale files have a .json file extension, and control translations for storefront content. These translations can be edited by merchants through the Shoplazza Language Editor. |
Schema
Locale files need to follow a specific naming structure. They also follow a basic organizational structure:
- Category: The top-level category of your translations.
- Group: The second level grouping of translations within a category.
- Description: The third level, represents the individual translations.
{
"my_category": {
"my_group": {
"my_description": "translation text",
...
},
...
},
...
}
Name locale files
Locale file naming must follow the standard IOS language code nomenclature, where the first lowercase letter code represents the language, and the second uppercase letter code represents the region.
For example:
Language | Storefront |
---|---|
Arabic - Saudi Arabia | ar-SA.json |
German - Germany | de-DE.json |
English - United States | en-US.json |
Usage
When working with locale files, you should familiarize yourself with referencing locale files. The code for referencing locale files varies depending on whether you're referencing a storefront locale file.
Updated over 1 year ago