The translation of Colobot level titles, level hierarchy and help files
is managed through translation files (*.pot
and *.po
) as those generated by
gettext. This is achieved by
a set of Python scripts using polib library.
The only requirement for generating translations is standard Python 2.7+ installation (polib library is bundled with other script files). If you don't have Python installed, nothing is generated and only English files are installed.
Level scene description files have English headers that are used in the
Colobot interface to describe the levels. Level scene description files
are levels/$level/scene.txt
and translations are handled in the
level-specific po/
directory: levels/$levels/po/
. The *.pot
file is the
source translation file, the *.po
files are the translations.
Help files are divided in two categories:
- Generic help files, about the game, the objects, the syntax, etc. These
are stored in
help/
, in 5 sub-categories: generic, bots, object, programs and cbots. - Level-specific help files, about the level, instructions, example
programs, etc. are stored like
levels/$type/$chapterXxx/$levelYyy/help/
. type beeing into : missions/freemissions/exercises/challenges & battles - some generics are also stored into
levels/other
Help files have their source in English, always stored in the E/
subdirectory. Every other language directory is dynamically generated
in the build process from files in level's po/
directory.
Colobot parses a specific syntax to enable some formatting in the game interface.
To ease translation, this syntax is transformed into a pseudo-HTML syntax in the gettext files.
Here is the table of transformations and their meanings:
Transformed label | Colobot native label | Description |
<button $buttonID/> | \button $buttonID; | Indicates a UI button. $buttonID is a number |
<key $keyCode/> | \key $keyCode; | Indicates a keyboard key. $keyCode is a code, such as action |
<format $formatID>Formatted text</format> | \$formatID;Formatted text\norm; | Changes text formatting in the marker. $formatID can be const, type, token or key. |
<$formatID/> | \$formatID; | Toggle text formatting. $formatID can be const, type, token, key or norm. |
<a $link>Link text</a> | \l;Link text\u $link; | Direct hyper-link. $link can be direct or in a category (such as cbot\abstime) |
<a $linkcat|$link>Link text</a> | \l;Link text\u $linkcat\$link; | In-category hyper-link, linkcat can only be cbot, bots or object. |
<code>CBot code</code> | \c;CBot code\n; | Code formatting |
<s/> | \s; | Typewriter line indicator (usually verbatim code) |
<t/> | \t; | Title line indicator |
<b/> | \b; | Subtitle line indicator |
<c/> | \c; | Typewriter formatting toggle |
<n/> | \n; | Normal formatting toggle |