Skip to content

Internationalization

Alexandre Bodelot edited this page Jun 27, 2014 · 1 revision

Internationalization (i18n)

Cosmoscroll uses translation files stored in the resources/lang directory. Available languages are English, French and German.

When the game is first launched (no settings file already existing), Cosmoscroll detects the system locale and tries to open the matching translation file located at resources/lang/{locale}.lang, where {locale} is the first two lower-case characters of the system locale. If there's no such file readable, en.lang (English) will be used instead.

At exit, the locale in usage is saved in the settings file, so it will be the default one at next launch.

Adding a new language

Create a new file in the resources/lang directory, be sure the file is named as {locale}.lang, where {locale} is the first two lower-case characters of the language locale.

Please use the English language file en.lang as reference.

Cosmoscroll does not list the language files in the lang directory. To make the new language visible in the settings menu, a new option must be added in the list box of the SettingsMenu class.

You can send your language file by creating a new issue or a pull request.

Syntax

Language files are plain-text files, they must be encoded in UTF-8. They contain one entry per line (\n will be parsed as a new line character), using the following format:

{identifier} = {displayed text}

Lines starting with a '#' character are ignored. Example:

# This is a comment
menu.play = Jouer
menu.about = À propos
Clone this wiki locally