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)
| Name | Type | Description |
|---|---|---|
locale | string | Chinese locale code (e.g. "zh_Hans", "zh_Hant", "zh_Hant_HK") |
- Source
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.
| Name | Type | Description |
|---|---|---|
locale | string | Locale code (e.g. "fr_CA", "de", "zh_Hans", "zh_Hant_HK") |
- Source
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).
| Name | Type | Description |
|---|---|---|
locale | string | Locale code in standard format (e.g. "fr_CA", "pt_BR", "zh_Hans") |
- Source
- 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).
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
key | string | Translation key (e.g. "ButtonPlay", "MessageVideoStartsIn") | ||
params | object | <optional> | invalid | Optional array of string replacements for {0}, {1}, etc. |
- Source
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().
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
baseKey | string | Base key without suffix (e.g. "LabelEpisodeCount") | ||
count | integer | The count to determine plural form | ||
params | object | <optional> | invalid | Optional placeholder params |
- Source
Translated plural string
- Type:
- string