Python 使用Gettext对PyGObject GUI进行本地化
我有一个名为locale的目录,以及包含语言(ru、ua、de等)的子目录 我的Python脚本已翻译为:Python 使用Gettext对PyGObject GUI进行本地化,python,python-3.x,pygobject,Python,Python 3.x,Pygobject,我有一个名为locale的目录,以及包含语言(ru、ua、de等)的子目录 我的Python脚本已翻译为: 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_langu
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
如何本地化GUI(在开发中)
我更喜欢使用Glade查看以下答案:
这个过程在那里解释得很好
此外,您可能还需要执行以下操作: