Schema locale files
Schema locale files are JSON files with a .schema.json
file extension. They host translation strings for various setting schema attributes so that content in the theme editor can be translated to the store's active language.
To learn which attributes can be translated, refer to Content.
Schema locale files are located in the locales
directory of the theme:
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, which represents the individual translations.
Name structure
Anchor link to section titled "Name structure"Locale file naming must follow the standard IETF language tag nomenclature, where the first lowercase letter code represents the language, and the second uppercase letter code represents the region.
For example:
Language | Format |
---|---|
English - Great Britain | en-GB.schema.json |
Spanish - Spain | es-ES.schema.json |
French - Canada | fr-CA.schema.json |
If a language isn’t region specific, you can use the 2-letter lowercase language representation.
For example:
Language | Format |
---|---|
Finnish - All regions | fi.schema.json |
Additionally, you must designate a default locale file.
The default locale file
Anchor link to section titled "The default locale file"You must designate a default locale file in the format of *.default.schema.json
, where *
is your selected language. This file contains the translations for the default language of the theme. Only one default file is permitted.
Most themes use en.default.schema.json
, which sets the default locale of the theme to English.
Schema locale files allow you to create translations for the following setting attributes:
Parent | Attribute |
---|---|
All settings |
|
|
name |
select |
group |
|
|
range |
unit |
|
content |
presets |
|
|
|
When working with schema locale files, you should familiarize yourself with referencing schema translations.
Reference schema translations
Anchor link to section titled "Reference schema translations"Schema translations can be accessed with code in the the following format:
For example, to make the name
attribute of the product.liquid
section translatable, use the following: