The purpose of this guide is to describe how to contribute to the Slic3rPE translations. We use GNUgettext for extracting string resources from the project and PoEdit for editing translations.
Those are possible to download here:
After GNUgettext is installed it is recommended to add the path to gettext/bin to PATH variable.
Full manual for GNUgettext you can see here: http://www.gnu.org/software/gettext/manual/gettext.html
Each string resource in Slic3rPE available for translation needs to be explicitly marked using L() macro like this:
auto msg = L("This message to be localized")
To get translated text use one of needed macro/function (_(s)
, _CHB(s)
or L_str(s)
).
If you add new file resourse, add it to list of files contaned macro L()
For conviniance create list of files with this macro L(s)
. We have
https://github.com/prusa3d/Slic3r/tree/master/resources/localization/list.txt.
Create template file(*.POT) with GNUgettext command:
xgettext --keyword=L --from-code=UTF-8 --debug -o Slic3rPE.pot -f list.txt
Use flag --from-code=UTF-8
to specify that the source strings are in UTF-8 encoding
Use flag --debug
to correctly extract formated strings(used %d, %s etc.)
Create PO- and MO-files for your project as described above.
To merge old PO-file with strings from creaded new POT-file use command:
msgmerge -N -o new.po old.po new.pot
Use option -N
to not using fuzzy matching when an exact match is not found.
To concatenate old PO-file with strings from new PO-file use command:
msgcat -o new.po old.po
Create an English translation catalog with command:
msgen -o new.po old.po
Notice, in this Catalog it will be totally same strings for initial text and translated.
When you have Catalog to translation open POT or PO file in PoEdit and start to translation. It's very important to keep attention to every gaps and punctuation. Especially with formated strings. (used %d, %s etc.)