Skip to main content

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:

└── theme
...
├── config
└── locales
├── en.default.schema.json
├── es-ES.schema.json
...

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

{
"my_category": {
"my_group": {
"my_description": "translation text",
...
},
...
},
...
}
Tip

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.

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

LanguageFormat
English - Great Britainen-GB.schema.json
Spanish - Spaines-ES.schema.json
French - Canadafr-CA.schema.json
sadasd

If a language isn’t region specific, you can use the 2-letter lowercase language representation.

For example:

LanguageFormat
Finnish - All regionsfi.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.

Schema locale files allow you to create translations for the following setting attributes:

ParentAttribute
All settings

info

label

settings_schema.json

Section schema

block

name
selectgroup

html

number

text

textarea

video_url

placeholder

rangeunit

header

paragraph

content
presets

name

category

html

inline_richtext

liquid

richtext

text

textarea

url

video

video_url

default


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:

t:translation_category.translation_group.translation_name

For example, to make the name attribute of the product.liquid section translatable, use the following:

locales/en.default.schema.json

{
"sections": {
"product": {
"name": "Product"
}
}
}

sections/product.liquid

{% schema %}
{
"name": "t:sections.product.name",
...
}
{% endschema %}

Was this page helpful?