i18n
i18n.locale(): string
Section titled “i18n.locale(): string”A BCP 47 tag in lowercase: en, fr, pt-br. From the host when it has one (filudi.com passes the
site’s locale; CrazyGames exposes user.systemInfo.locale; Playgama bridge.platform.language; Poki has
none), else navigator.language, else en. init({ locale }) overrides all of it. Throws before
init() resolves.
const strings = { en, fr };let t = strings[sdk.i18n.locale().split('-')[0]] ?? en;const strings: Record<string, Strings> = { en, fr };let t: Strings = strings[sdk.i18n.locale().split('-')[0] ?? 'en'] ?? en;i18n.on('change', listener): Off
Section titled “i18n.on('change', listener): Off”Fires when the host switches locale while the game runs; filudi.com does when the player changes the site
language. The listener gets the new tag. sdk.on('locale', listener) is the same event under the host
events.
sdk.i18n.on('change', (locale) => { t = strings[locale.split('-')[0]] ?? en; redrawMenus();});sdk.i18n.on('change', (locale: string) => { t = strings[locale.split('-')[0] ?? 'en'] ?? en; redrawMenus();});Unavailable cases
Section titled “Unavailable cases”None: there is always a locale. A host without one gives the browser’s. Which languages filudi.com runs in, and what to translate first, is in localization.