Locale¶
System · Locale · server and client scripts
Locale gets and sets the place's language, loads in-memory place translations, and formats translated strings. On the server Get and System return "en" and Translate returns the key unchanged.
A language tag is a BCP-47 language code with optional script and region, such as "pt-BR" or "zh-Hans". Lookups try the full tag, drop trailing subtags one by one, and fall back to English.
Get¶
Get returns the active BCP-47 language tag for the place, "en" until changed.
Example
System¶
System returns the player's platform BCP-47 language tag before any place override.
Set¶
Set switches the active language tag for this session and fires Changed when the tag changes.
AddTranslations¶
AddTranslations registers in-memory place translations keyed by BCP-47 locale tag and message key.
Example
Translate¶
Translate returns the translation of key in the active language, substituting brace placeholders from optional params, or the key itself when no translation matches.
Example
Changed¶
Changed fires with the new BCP-47 tag when the active place locale changes.