翻译 JFace 中的控件
我有一个使用 org.eclipse.jface.preference.FieldEditorPreferencePage 来创建首选项页面的应用程序。在我开始国际化我的应用程序期间,我注意到我无法覆盖名为“恢复默认值”和“应用”的按钮的创建,因此名称始终保持英文。
我注意到 JFace jar 中有一个 messages.properties 文件,其标签用于分配名称。但是如何将 JFace 重新分配给另一个包呢?
I have an application that uses org.eclipse.jface.preference.FieldEditorPreferencePage in order to create preference pages. During the time I started internationalizing my app I noticed that I cannot override the creation of buttons named "Restore Defaults" and "Apply", hence names remain English all time.
I have noticed there is a messages.properties file in JFace jar, whose lables are used to assign names. But how to reassign JFace to another bundle then?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要从此处下载语言包:
http://archive.eclipse.org/eclipse/downloads/drops/L-3.2.1_Language_Packs-200609210945/index.php
NLpack2-eclipse-SDK-3.2.1-当我使用 Eclipse 3.7.2 时,gtk.zip 适用于我。
从存档中提取 org.eclipse.jface.nl2_3.2.1.v200609270227.jar(或适合您语言的其他 nl)并将其添加到您的项目中。它将自动使用。
You need to download a language pack from here:
http://archive.eclipse.org/eclipse/downloads/drops/L-3.2.1_Language_Packs-200609210945/index.php
NLpack2-eclipse-SDK-3.2.1-gtk.zip
works for me while I'm using Eclipse 3.7.2.Extract
org.eclipse.jface.nl2_3.2.1.v200609270227.jar
(or other nl for your language) from the archive and add it to your project. It will be used automatically.这些字符串是从 bundle < code>"org.eclipse.jface.messages" 它们的键是“defaults”、“apply”。
String[] labels = JFaceResources.getStrings(new String[] {"defaults", "apply" });
您应该为您的语言环境提供正确的资源包,并且它应该可以工作,您可以做的就是不要通过调用受保护的方法
noDefaultAndApplyButton()
创建这些按钮Those string are retrieve from bundle
"org.eclipse.jface.messages"
their keys are "defaults", "apply".String [] labels = JFaceResources.getStrings(new String [] {"defaults", "apply" });
You should provide the correct resource bundle for your locale, and it should work other thing what you can do is to do not create those buttons by calling protected method
noDefaultAndApplyButton()