在 RCP 应用程序中将翻译添加到 Eclipse e4 PartStack

Add translation to Eclipse e4 PartStack in RCP application

我正在尝试翻译我们的 e4 RCP 应用程序中的上下文菜单条目,例如 PartStacks 上下文菜单中的 "Close" 和 "Close All"。

自从我看到 Babel 插件为 Eclipse IDE 做的正是那样,我检查了他们的代码以及他们是如何做的。好像他们加了一个插件

org.eclipse.e4.ui.model.workbench.nl_de

其中包含与默认 "message.properties" 相同的 folder/package 结构下的 "message_de.properties",即 "org.eclipse.e4.ui.internal.workbench.renderers.swt".

好吧,我在我们自己的应用程序中尝试过,但正如我所料,它没有用。我错过了什么?我想我在这里遗漏了一些要点,因为拥有 messages.properties 文件而不是硬编码字符串的整个逻辑是允许本地化,对吧?

要添加额外的消息属性文件,您应该使用扩展插件的 'plugin fragment'。这就是 Babel 罐子使用的。

使用'File > New > Project > Plug-in Development > Fragment Project'创建插件片段项目。

在这种特殊情况下,SWTRenderersMessages 将查找 messages_de.properties,但仅在插件或插件片段的 org.eclipse.e4.ui.internal.workbench.renderers.swt 文件夹中查找。