简体   繁体   English

使用Glade和Python构建的GUI的本地化(Gtk)

[英]Localization of GUI built with Glade and Python (Gtk)

I have made an application using Glade and Python and I would like to make several localizations. 我使用Glade和Python创建了一个应用程序,我想进行多次本地化。

I know how to localize strings that are in the Python code, I just encapsule all the strings that are supposed to be localized with _() and than specify the translation of the string in a .po file. 我知道如何本地化Python代码中的字符串,我只是封装了应该用_()本地化的所有字符串,而不是在.po文件中指定字符串的转换。

But how do I tell a string that is built with Glade that it should be localizable (for example labels, menu items, button labels, ...)? 但是,如何告诉使用Glade构建的字符串,它应该是可本地化的(例如标签,菜单项,按钮标签......)?

I am using gettext for the localization. 我使用gettext进行本地化。

Thank you, Tomas 托马斯,谢谢你

You should be able to create a *.pot file from a *.glade file using intltool-extract --type=gettext/glade foo.glade , and intltool supposedly knows what is translatable. 你应该能够使用intltool-extract --type=gettext/glade foo.glade从* .glade文件创建一个* .pot文件,而intltool应该知道什么是可翻译的。

Also, I suggest you look into GtkBuilder if you didn't do that already (you can save GtkBuilder interface files from recent Glade 3 versions, and you won't need the extra libglade anymore). 另外,如果你没有这样做,我建议你研究一下GtkBuilder(你可以从最近的Glade 3版本中保存GtkBuilder接口文件,你将不再需要额外的libglade)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM