安装在 Eclipse 应用程序中时,在 Eclipse plugin.xml 文件中找不到国际化字符串

发布于 2024-08-31 16:21:24 字数 880 浏览 3 评论 0原文

我创建了 2 个插件,实现了 ODA 驱动程序插件及其用于 Eclipse 的 BIRT 扩展的 UI 插件。

当 eclipse 启动另一个 eclipse 应用程序时,我的插件都按预期工作,然后我可以在其中测试我正在开发的插件。但是,当我将插件安装到 Eclipse 应用程序中,然后从 Windows 快捷方式启动它时,插件可以工作,但找不到在 plugin.xml 文件中指定的语言键。

例如,在 ODA 驱动程序插件的 plugin.xml 文件中,我将属性“id”设置为“%oda.data.source.id”,将数据源“defaultDisplayName”设置为“%data.source.name”。 然后,我在文件“language.properties”中定义了这两个键的值(其中键没有前面的 % 字符)。

运行已安装到 Eclipse 应用程序 dropins/plugins 目录中的插件时,用于创建 ODA 数据源名称的向导为“%data.source.name”,并将数据源保存在 rptdesign (XML) 文件中ID 为“%oda.data.source.id”。

由于“语言”不是属性文件的默认名称,我进入了两个插件的清单并将“Bundle-Localization”属性更改为“语言”。语言文件位于我的两个插件的根目录中。

属性文件肯定是找到的,因为我使用这两种语言文件来存储插件使用的其他字符串,使用 java ResourceBundle 进行查找。无论插件是从加载另一个插件的 Eclipse 应用程序运行,还是正确安装在 Eclipse 应用程序的 dropins/plugins 目录中,都始终可以找到这些字符串。

为什么已安装的插件在plugin.xml 文件中找不到语言键引用?日志中没有错误,并且 language.properties 文件可以清楚地访问...

提前致谢。

I have created 2 plugins, implementing an ODA driver plugin and its UI plugin for the BIRT extension to Eclipse.

My plugins both work as expected when eclipse starts up another eclipse application where I can then test the plugins I am developing. However, when I install my plugins into an Eclipse application and then start it from a Windows shortcut, the plugins work but and language keys specified in the plugin.xml files are not found.

For example, in my plugin.xml file for the ODA Driver plugin I set the attributes 'id' to '%oda.data.source.id' and the data source 'defaultDisplayName' to '%data.source.name'.
I then, in a file 'language.properties', have defined the values for both of these keys (where the keys don't have the preceeding % character).

When running the plugins that have been installed into the dropins/plugins directory of an Eclipse application, the wizard for creating my ODA data source names is as '%data.source.name' and saves the data source in the rptdesign (XML) file with an ID of '%oda.data.source.id'.

Since 'language' is not the default name for the properties file I went into the manifest for both plugins and changed the 'Bundle-Localization' attribute to 'language'. The language file is located in the root directory of both of my plugins.

The properties file is definitely found, since I use the two language files to store other strings used by the plugins, looked up using a java ResourceBundle. The strings are always found whether the plugins are run from Eclipse application loading another, or when properly installed in the dropins/plugins directory of an Eclipse application.

Why are the installed plugins not finding language keys reference in the plugin.xml files? There are not errors in the logs and the language.properties files are clearly accessible...

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

甜点 2024-09-07 16:21:24

它应该有效。插件清单文件应该有一行:

Bundle-Localization:language

并且在插件的顶层放置属性文件的不同翻译,就像

language_en_US.properties
language_fr.properties
language_ja_JP.properties

我曾经因为文件中的 BOM 前缀而遇到属性文件的(无声)错误一样。从那时起,我总是在第一行添加注释(以 # 开头),以确保操作系统不会妨碍...还要检查换行符是否正确,之前没有 \,编码是 unicode 等。

祝你好运!

It should work. The plugin manifest file should have a line:

Bundle-Localization:language

and at the toplevel of your plugin put the different translations of your property file, like

language_en_US.properties
language_fr.properties
language_ja_JP.properties

I've got once an (silent) error with a property file, because of the BOM prefix in file. Since then, I always put a comment at first line (starting with #) to be sure the OS is not getting in the way... Also check the newline is correct without a \ before, encoding is unicode, etc.

Good luck!

我还不会笑 2024-09-07 16:21:24

您确定plugin.properties 文件包含在您的构建中吗?
在清单的“构建”页面上,确保已选中它,以便将其放入
插件 jar 文件。

Are you sure the plugin.properties file is included in your build?
On the Build page of the manifest, make sure it's checked so it gets put into the
plugin jar file.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文