MySource Matrix Developer

Main Content

Understanding Locale Structure

Language, Country and Variant

The locale structure used by MySource Matrix mirrors that used by many operating systems, including Linux-based systems (often found in the /usr/share/locale directory of such systems). This system defines a locale as a combination of up to three parts: language, country, and variant.

Language

The first part of the locale specifies the language. MySource Matrix uses the language abbreviations as specified by the standard ISO 639. The two-letter (ISO 639-1, or 'Alpha-2') abbreviations are preferred - chosen as this is what is often currently used in most Linux-based systems. However, three-letter (ISO 639-2, or 'Alpha-3') abbreviations are also acceptable when an appropriate two-letter abbreviation is not available.

The English language, for example, is represented by the two-letter code 'en'. The German language is represented by 'de', Japanese by 'ja', and so on.

Country

The second part of a full locale is a country code, generally the two-letter codes as specified by the standard ISO 3166. The country part of a locale is important when different dialects of a language are spoken in different countries.

The language and country parts of a locale are separated using an underscore ('_').

For example, 'en_AU' specifies the English language as used in Australia, whereas 'en_GB' denotes English as used in the United Kingdom. Similarly, 'fr_FR' specifies the French language as used in France, while 'fr_CA' is the French dialect used in Canada.

Variant

The final and most rarely used part of a full locale is known as the variant. This is not specified for the main usage of the language and/or country combination. However, it may be used to specify different variants of that combination. For example, different collating orders for a single language - such as special phone-book sort orders as used in some countries - may use a variant.

Note that the non-language aspects of localisation often come into play here - for example, many Linux-based systems use a variant for support of the Euro currency. For example, 'fr_FR@euro' specifies French as used in France, with Euro support. Depending on the implementation, 'fr_FR' may either be symbolically linked to the Euro support version, or be a separate locale with support for the former Franc currency.

If specified, the variant part is separated from the rest of the locale by an '@' character. In MySource Matrix, variants are only accepted when both language and country are specified. Therefore 'en@variant' is not considered valid.

Locale Hierarchy in MySource Matrix

By default, if a locale with more than one 'part' is specified, then all strings from the 'parent' locales will be included. Child locales will then override their parents with resources explicitly specified at their level.

The Locale Directory

All locale-specific information is stored inside a special directory called 'locale'. One locale directory exists for each asset and package, and a core locale directory in [SYSTEM ROOT]/core/locale containing system-wide resources.

Within each locale directory, top-level directories represent languages, child folders of these represent countries, and children of the country folders represent variants.

Asset Folder
|_ asset.xml
|_ asset_name.inc
|_ asset_name_edit_fns.inc
|_ asset_name_management.inc
|_ ...more files (eg. screens)...
|_ locale
  |_ en
  | |_ (resources for en)
  | |_ AU
  | | |_ (resources for en_AU)
  | |_ ...more sub-locales...
  | |_ GB
  |   |_ (resources for en_GB)
  |_ de
    |_ (resources for de)
    |_ (...sub-locales...)