wxpython 的 I18n wx.AboutBox

I18n for wxpython wx.AboutBox

我即将制作一个 wxpython 程序 t运行slatable。 我使用 python gettext 调用:

import gettext
languagelist = [locale.getdefaultlocale()[0], 'en_US']
t = gettext.translation('myProgram', localedir, ['de_DE','en_US'])
_ = t.ugettext

这适用于以下所有情况:

self.statusbar.PushStatusText(_('Connecting service ...'))

但是现在有这个wx.AboutBox

info = wx.AboutDialogInfo()
info.Name = swname
info.Version = swversion
info.Developers = swdevelopers
info.License = wordwrap(swlicense, 500, wx.ClientDC(self))
wx.AboutBox(info)

此 AboutBox 有标记为 "Developers" 和 "License" 的按钮,这些按钮没有得到 t运行 指定。

毫不奇怪,我只是 运行 pygettext -d myProgram mainFile.py 创建 .pot 文件。

那么如何将 wx.AboutBix 中的文本放入我的 .pot 文件中?

它们已经为您翻译并包含在 wxstd.pot 中,分别包含在相关语言的 wxstd.mo 中。

在 wxPython Phoenix 文档中有更多信息和一个小示例应用程序 - http://wxpython.org/Phoenix/docs/html/internationalization.html?highlight=i18n 这也适用于您可能使用的 wxPython Classic。