Skip to content

Latest commit

 

History

History
30 lines (19 loc) · 2.1 KB

translate.md

File metadata and controls

30 lines (19 loc) · 2.1 KB

Translation

The game server supports internationalisation ("i18n") using lean-i18n and i18next.

The intended workflow currently is the following:

  1. When you call lake build in your game, it should automatically create a template file .i18n/en/Game.pot. Alternatively you can call lake exe i18n --template to recreate it.
  2. Open the file Game.pot (the "t" stands for "template") with Poedit (or a similar software) and translate all strings. Save your work as .i18n/{language}/Game.po.
  3. Call lake exe i18n --export-json to create all Json files .i18n/{language}/Game.json which the server needs.
  4. Add your translations (i.e. .po and .json, but not the .mo files) and push your results, and publish the game.

If you choose the correct language in the "Preferences" of the game, you should see your translations.

Alternative: avoiding .po

Note: This workflow is subject to change, and it might be that in future the server can directly read .po files. Until then, there is also an alternative workflow you might choose:

  1. Add useJson: true to .i18n/config.json
  2. lake build or lake exe i18n --template will now create a Json instead: .i18n/en/Game.json.
  3. Add translations to a copy of this Json an save it as .i18n/{language}/Game.json

Non-English games

For games written in a language different than English, you should set the correct source language (sourceLang) in .i18n/config.json. Afterwards, on lake build the template should appear under the chosen language, and can be translated (e.g. into English) as described above.

New languages

The server has a set number of languages one can select. If your game has been translated to a language not selectable, open an issue at lean4game requesting this new language. Or, even better, create a PR to translate the server interface into that new language.