Locales

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

  • Storefront - These have a .json extension, and control storefront translations.

Locale files are hosted in the locales directory of a theme.

Structural overview

Both locale file types follow the same general format of being organized into the following levels:

  • Category: The top-level category of your translations. For example, general contains general translations.
  • Group: The second level grouping of translations within a category. For example, 404 contains general translations related to the 404 page.
  • Description: The third level, which represents the individual translations. For example, title contains the title of the 404 page

📘

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.

How to create locale files

Add a new locale file through the theme code editor.

Add a new locale

To add a new locale through the code editor:

  1. From your Shoplazza admin, go to Store > Themes.
  2. Find the theme you want to edit, and then click Operation > Theme code.
  3. Scroll down the left sidebar and click Locales, then click Add a new locales.
  4. Enter a name for the file, without the .json extension, then click Confirm.

📘

Tip

Refer to Name locale files for information on how these files should be named.

Name locale files

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:

  • en-GB.json for English - Great Britain
  • es-ES.json for Spanish - Spain
  • fr-CA.json for French - Canada

Did this page help you?