Localization of PyGObject GUI using Gettext

248 views Asked by At

I have directory, which is called locale and subdirectories with languages (ru, ua, de etc.)

My Python script is translated:

from libs.gettext_windows import gettext_windows

scriptdir = os.path.abspath(os.path.dirname(__file__))  # directory with this script
# translating strings in _()
lang = gettext_windows.get_language()
translation = gettext.translation("vk_stats", localedir="{}/locale".format(scriptdir), languages=lang)
_ = translation.gettext

How I can localize my GUI (in development)?

vk_stats.ui

I prefer to use Glade.

1

There are 1 answers

0
Havok On BEST ANSWER

See this answer:

https://stackoverflow.com/a/10540744/439494

The procedure is very well explained there.

Also you might need to do this also:

https://stackoverflow.com/a/8377533/439494