Overview

Locales are JSON files used for translating text strings throughout the theme and the theme editor.

Locales not only provide a unified location for configuring repeated words and copy across the theme but also allow you to set up international translations for merchants and customers within the theme and theme editor.


Location

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

└── theme
...
└── locales

Types

There are two types of Locales files:

TypeDescription
StorefrontStorefront locale files have a .json file extension and control the translation of storefront content. Merchants can edit these translations using the SHOPLINE language editor.
SchemaSchema locale files have a .schema.json file extension and set up multilingual translations for theme editor configuration items.

Structure

Locale files need to follow a specific naming structure and adhere to a basic organizational format:

  • Products: The top-level products of translations.
  • Product_list: The second-level grouping within the products.
  • Load_more_tip: The third level, representing individual translations.
{
"products": {
"product_list": {
"load_more_tip": "custom text",
...
},
...
},
...
}
Tip

When naming translation descriptions, be descriptive enough to provide translation context. For example: order.order_details.insuranceService_content_email provides more context than order.order_details.email.


File Naming

Locale file names must adhere to the standard IETF language tag format. This format uses a lowercase language code followed by .schema.json. For example:

LanguageSchemaStorefront
Englishen.schema.jsonen.json
Indonesianid.schema.jsonid.json
Thaith.schema.jsonth.json
Note

The exceptions are Simplified Chinese and Traditional Chinese, which are:

LanguageSchemaStorefront
Simplified Chinesezh-hans-cn.schema.jsonzh-hans-cn.json
Traditional Chinesezh-hant-tw.schema.jsonzh-hant-tw.json

Usage

The referenced code varies based on the type of locale file. It differs between a storefront locale file and a schema locale file.

Was this article helpful to you?

Error loading component.

Error loading component.