pyorpg-client
pyorpg-client copied to clipboard
Add localization to the client (translations)
I just recently added support for localizations using the gettext
module from Python. See: https://github.com/marcusmoller/pyorpg-client/commit/ee6d690a9c6ddff84b1241b85559665e2f2102a7
I haven't finished making all the strings in the application into gettext-strings, so that should be done first of all.
This is done by simple adding the _(
prefix and )
suffix to strings.
An example: "This is a string in Python"
becomes _("This is a string in Python!")
.
When all that is done, it's time to translate the strings into new languages.
I have added two tools for making it easier to create the .po
files for translations.
- https://github.com/marcusmoller/pyorpg-client/blob/master/tools/create-po.sh will search for all gettext-strings in the source code and create a
messages.po
which allows for easy translating. - https://github.com/marcusmoller/pyorpg-client/blob/master/tools/convert-po.sh converts the created AND TRANSLATED
messages.po
from src/ into a.mo
-file which is then able to be read by the client. Please note that you should editconvert-po.sh
so that it's not ouputtingmessages_en.mo
but rather you localization of choice, saymessages_de.mo
.