REDNODE / DOCS

Ink language

Example apps / ink-language / v0.1.0

Node modneeds codeware

A HUD panel in the player's language: the game's own text by key, and the package's own text from locales files with a parameter, plurals and V's gender. It follows a language change in the game.

Simulated game starting
Mod log

    The simulated game speaks English, so the preview shows the English file; the game's keys show their English words.

    How it works

    An ink text set to "LocKey#15396", or with key: "UI-ResourceExports-Inventory", shows the game's own word in the player's language: the game translates it, and follows a change by itself.

    t("reward", { amount: 500 }) takes the text from locales/<language>.json. count picks a plural form and m and f forms follow V's gender. A key French lacks shows in English, and a key no file has shows as itself; each is logged once.

    An ink text showing t()'s text is sent again in the new language when the game's language changes. game.language() gives the game's name and the standard tag, for Intl.

    What it uses

    t() locales/<language>.json LocKey# key game.language game.on("language") Intl

    Try this

    Use it

    Copy the files into red4ext/plugins/REDnode/apps/ink-language/ in the game folder, or start your own package from them: change id and name in the manifest first. The whole folder is on GitHub.