Skip to content

i18n

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.

Pick the strings

const strings = { en, fr };
let t = strings[sdk.i18n.locale().split('-')[0]] ?? en;

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.

Redraw on a switch

sdk.i18n.on('change', (locale) => {
t = strings[locale.split('-')[0]] ?? en;
redrawMenus();
});

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.