使用 Gettext 对 PyGObject GUI 进行本地化
Localization of PyGObject GUI using Gettext
我有一个名为 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。
看到这个答案:
程序在那里解释得很好。
此外,您可能还需要这样做:
我有一个名为 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。
看到这个答案:
程序在那里解释得很好。
此外,您可能还需要这样做: