Skip to content

Locales

Locale files are JSON files that contain a set of translations for text strings used throughout the theme and theme editor.

In addition to giving sellers a single place to easily edit words and phrases that are repeated throughout the theme, locale files allow you translate storefront content, and theme editor settings, to multiple langages for international sellers and customers.

Location

Locale files are located in the locales directory of the theme:

bash
└── theme
    ...
    └── locales

Types

There are two types of locale files:

TypeDescription
StorefrontStorefront locale files have a .json file extension, and control translations for storefront content. These translations can be edited by sellers through the theme's language editor.
SchemaSchema locale files have a .schema.json file extension, and control translations for theme editor settings.

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.

LanguageStorefrontSchema
Englishen.jsonen.schema.json
Arabicar.jsonar.schema.json
Frenchfr.jsonfr.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 *.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. For example:

StorefrontSchema
en.default.jsonen.schema.default.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 or a schema locale file.