Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/320.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 使用Gettext对PyGObject GUI进行本地化_Python_Python 3.x_Pygobject - Fatal编程技术网

Python 使用Gettext对PyGObject GUI进行本地化

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

我有一个名为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_language()
translation = gettext.translation("vk_stats", localedir="{}/locale".format(scriptdir), languages=lang)
_ = translation.gettext
如何本地化GUI(在开发中)

我更喜欢使用Glade

查看以下答案:

这个过程在那里解释得很好

此外,您可能还需要执行以下操作: