-
Notifications
You must be signed in to change notification settings - Fork 46
Localisation
BEEmod has localisation support for the application interface, as well as the contents of packages. Translations are stored using the GNU gettext format, and consist of three files:
-
POT
files are generated from the BEE2 source code or package configuration, and are a template that can be copied to construct a newPO
translation. -
PO
files are a text file containing the new translation. -
MO
files are a compressed form of thePO
file, which is actually read by the BEE2 appication to translate text.
To save space, the POT
and PO
versions of translations are not included in the regular download. Clone or download the application/packages repo to get the original copies, then open an existing PO
file or copy and rename the POT
if this language has not started to be translated yet. The easiest way to edit these is with a dedicated program like PoEdit, but you can just use a regular text eitor. The file format consists of pairs of msgid
and msgstr
keys, where the msgid
keys match text in the original configs/source code. These shouldn't be changed, instead a translated version put in msgstr
.
The special symbol \n
is used to indicate a newline. For application text, fields like {name}
should be kept as is - these are subsituted with the appropriate text when displayed. They however can be reordered if the sentence works better that way. For the UI it is important to set "msgid" "__LanguageName"
to the name of this language, so it can be displayed in the selection dropdown.
Once a translation is complete, it should be placed in the i18n
(InternationalizatioN) folder, then compiled into a .mo
file by clicking Build Package Translations button in the app options. The packages you wish to compile must be unzipped.
To generate the POT
template for your package, click Build Package Translations button in app options. This will scan the loaded package for translatable symbols, then generate a POT
template. If PO
files are also present, these will also be updated, adding entries for new text, and commenting out now unused translations for manual review and deletion. They will then be compiled into MO
files for display. It is recommended that you use this button before releasing your package to the public.