Methods

(static) loadChineseLocaleFile(locale) → {object}

Load Chinese locale translations with script code layering. Chinese locales use script codes (Hans=Simplified, Hant=Traditional) instead of region codes. Supports 3-layer loading for maximum coverage: zh_Hans: zh.json -> zh_Hans.json (2 layers) zh_Hant: zh.json -> zh_Hant.json (2 layers) zh_Hant_HK: zh.json -> zh_Hant.json -> zh_Hant_HK.json (3 layers)

Parameters:
NameTypeDescription
localestring

Chinese locale code (e.g. "zh_Hans", "zh_Hant", "zh_Hant_HK")

Returns:

Parsed roAssociativeArray, or invalid if no file found

Type: 
object

(static) loadLocaleFile(locale) → {object}

Load a locale's translations, layering regional over base when applicable. For regional locales (e.g. "fr_CA"), loads the base language ("fr") first, then overlays regional translations on top. Regional values win on conflicts. For Chinese script codes (e.g. "zh_Hant_HK"), uses 3-layer loading: zh -> zh_Hant -> zh_Hant_HK for maximum translation coverage. For base locales (e.g. "fr"), loads directly.

Parameters:
NameTypeDescription
localestring

Locale code (e.g. "fr_CA", "de", "zh_Hans", "zh_Hant_HK")

Returns:

Parsed roAssociativeArray, or invalid if no file found

Type: 
object

(static) loadTranslations(locale) → {void}

Load translation files for a given locale into m.global. Always loads en_US as fallback. When the active locale IS en_US, both m.global.translations and m.global.translationsFallback reference the same AA (no double memory).

Parameters:
NameTypeDescription
localestring

Locale code in standard format (e.g. "fr_CA", "pt_BR", "zh_Hans")

Returns:
Type: 
void

(static) translate(key, paramsopt) → {string}

Translate a key, optionally substituting indexed placeholders {0}, {1}, etc. Falls back to en_US if key is missing from active locale, or returns the key itself if missing from both (makes untranslated strings visible during dev).

Parameters:
NameTypeAttributesDefaultDescription
keystring

Translation key (e.g. "ButtonPlay", "MessageVideoStartsIn")

paramsobject<optional>
invalid

Optional array of string replacements for {0}, {1}, etc.

Returns:

Translated string, or the key itself if not found

Type: 
string

(static) translatePlural(baseKey, count, paramsopt) → {string}

Translate a plural key using zero/one/many suffix convention. Selects the appropriate variant based on count, then delegates to translate().

Parameters:
NameTypeAttributesDefaultDescription
baseKeystring

Base key without suffix (e.g. "LabelEpisodeCount")

countinteger

The count to determine plural form

paramsobject<optional>
invalid

Optional placeholder params

Returns:

Translated plural string

Type: 
string