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.
Anchor to LocationLocation
Schema locale files are located in the locales
directory of the theme:
Anchor to SchemaSchema
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.
Example
When naming translation descriptions, try to be descriptive enough to give the translation context. For example, blogs.article_comment.submit_button_text
gives more context than blogs.article_comment.submit
.
Anchor to Name structureName 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:
fsfszgaerga
Language | Format |
---|---|
English - Great Britain | en-GB.schema.json |
Spanish - Spain | es-ES.schema.json |
French - Canada | fr-CA.schema.json |
sadasd |
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.
Anchor to The default locale fileThe default locale file
You must designate a default locale file in the format of *.default.{% if include.parent == 'schema' %}schema.{% endif %}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.{% if include.parent == 'schema' %}schema.{% endif %}json
, which sets the default locale of the theme to English.
Anchor to ContentContent
Schema locale files allow you to create translations for the following setting attributes:
Parent | Attribute |
---|---|
All settings |
|
| name |
select | group |
|
|
range | unit |
| content |
presets |
|
|
|
Anchor to UsageUsage
When working with schema locale files, you should familiarize yourself with referencing schema translations.
Anchor to Reference schema translationsReference 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: