pyorpg-client icon indicating copy to clipboard operation
pyorpg-client copied to clipboard

Add localization to the client (translations)

Open marcusmoller opened this issue 11 years ago • 0 comments

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 edit convert-po.sh so that it's not ouputting messages_en.mo but rather you localization of choice, say messages_de.mo.

marcusmoller avatar Sep 17 '13 13:09 marcusmoller