Luduvo Contents
Theme
On this page

Locale

reads and switches the active locale, and translates a key into the text of that locale

Methods

3 members Access: shared

Get() -> string

the current locale tag

Set(tag: string) -> (boolean, string)

switch the locale

Parameters
NameTypeDescription
tagstringLanguage tag such as "en-US".
returns(boolean, string)—
Translate(key: string) -> string

translate a key

Parameters
NameTypeDescription
keystringTranslation key to look up in the active locale.
returnsstring—

Switching the Active Locale

Lifecycle: Shared

Set answers with a status word, and Translate hands back the key itself when the locale has no text for it.

Luau
local ok, status = game.Locale.Set("pt-BR")if not ok then	warn("Locale rejected:", status)endprint(string.format("%s: %s", game.Locale.Get(), game.Locale.Translate("ui.play")))
Output: pt-BR: Jogar