Translating the game
How rugen's menus are translated, and how to add or fix a language file in motif/lang/.
Every word the menus show comes from one table per language in
motif/lang/ next to the themes: en.toml is the English source, the
other files translate it key by key. The game ships English, Brazilian
Portuguese (pt-BR), Spanish (es), French (fr), Italian (it),
German (de), Polish (pl), Turkish (tr), Indonesian (id), Filipino
(fil) and Japanese (ja). OPTIONS → INTERFACE → LANGUAGE picks one;
AUTO follows the operating system ([interface] lang).
The files
A language file is plain TOML: one [section] per screen ([title],
[select], [online], [options], …) and [common] for the words
several screens share. Each key is a stable id; the value is the text.
[title]
press_to_try = "PRESS ▶ TO TRY"
[select]
pn_fighter_i_of_n = "P{p} : FIGHTER {i} OF {n}"
[common]
back = "BACK"
- Keys never change. A translation file carries the same keys as
en.toml; a key it lacks reads in English, so a half-done file is still usable. {name}placeholders are filled by the game ({p},{i}and{n}above). Keep every one of them, in whatever order the sentence needs.- Capitals follow the English. A key whose English value is written
in capitals (
"BACK") is drawn in capitals in every language, whatever case the translation uses: write"Retour"or"RETOUR", both show as RETOUR. Keys written in sentence case (help lines) show as written. Japanese has no case and is never changed. - Themes refer to a key as
text = "@common.back"in their screen TOML, the engine ast("common.back"); a@keywith a key nobody defines shows the key itself, which is how a typo looks.
Adding or fixing a language
- Copy
motif/lang/en.tomltomotif/lang/<code>.toml(eo.toml, say), or open the shipped file you want to improve. In a portable installmotif/is next to the game; a system package keeps it in/usr/share/rugen/motif/. - Translate the values, key by key. Leave fighter and mode names the docs keep in English (ARCADE, RANKED, CPU …) if your community uses them; the shipped translations follow the docs of their language.
- Set
[interface] lang = "<code>"inrugen.toml(the picker lists the shipped languages; any file name works from the config). - Start the game, or keep it running:
motif/lang/is watched, and saving a file redraws the open screens with the new text. Too long a line for its slab or button is the usual problem: shorten it, or check the other theme (Dojo and Shonen Ink size their rows differently).
Every language file is checked by the engine’s tests: every key of
en.toml present, the same {placeholders}, no empty value.
python3 scripts/i18n-strings.py check in the repository runs the same
check from the command line, and list prints every string the sources
still hold in English.
Sending a translation
Open a pull request on the engine repository with the file, or attach it
to an issue. Say which screens you checked in both themes; a screenshot of
anything that overflows helps. The strings move with the game: a new
version adds keys to en.toml, and the tests list the ones each language
is missing.
このページに誤りがありますか? GitHub で編集する.