Skip to 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.

Location

Schema locale files are located in the locales directory of the theme:

bash
└── theme
    ...
    ├── config
    └── locales
      ├── en.schema.default.json
      ├── ar.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.

  • Translation: The third level, which represents the individual translations.

json
{
  "my_category": {
    "my_group": {
      "my_translation": "translation text",
      // ...
    },
    // ...
  },
  // ...
}

File Naming

You can use the 2-letter lowercase language representation to name your locale files.

LanguageFormat
Frenchfr.schema.json
Englishen.schema.json
Arabicar.schema.json

Additionally, you must designate a default locale file for each type.

Default Locale File

You must designate a default locale file in the format of *.schema.default.json, where * is your selected language. This file contains the translations for the default language of the theme. Only one default file is permitted.

Example
en.schema.default.json

Usage

When working with schema locale files, you should familiarize yourself with referencing schema translations.

Reference schema translations

Schema translations can be accessed with code in the the following format:

bash
t:translation_category.translation_group.translation_name

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

json
{
  "sections": {
    "featured-product": {
      "label": "Product"
    }
  }
}
liquid
{% schema %}
{
  "label": "t:sections.featured-product.label",
}
{% endschema %}