在 MANIFEST 文件中使用外部捆绑包本地化路径

发布于 2024-07-17 15:18:39 字数 733 浏览 6 评论 0原文

MANIFEST.MF 文件包含一个条目,用于定义在运行时加载哪些 *.properties 文件。 这些条目定义名称和相应的属性文件,用于翻译以前缀“%”开头的插件字符串,例如“%plugin.name”

Bundle-Localization: plugin

plugin.properties 包含一行,如

%plugin.name=Runtime Plugin

属性文件也可以具有名称application.properties,比我必须定义

Bundle-Localization: application

当属性文件位于插件子目录“properties”内时,我可以定义

Bundle-Localization: properties/application

我的问题: 我可以定义一个插件外部的 Bundle-Localization 路径吗?看起来

Bundle-Localization: ../properties/application

,正在搜索属性文件路径的 ManifestLocalization 对象确实会向 ZipFile 询问路径。 并且 ZipPath 不支持此功能。

我该如何解决这个问题?

The MANIFEST.MF file contains an entry to define which *.properties files are loaded at runtime. These entries define the name and the corresponding properties file which is used to translate the plugin strings which start with the prefix "%", like "%plugin.name"

Bundle-Localization: plugin

plugin.properties than contains a line like

%plugin.name=Runtime Plugin

the properties file also can have the name application.properties, than i have to define

Bundle-Localization: application

When the properties files are inside a plugin sub directory "properties" i can define

Bundle-Localization: properties/application

My Question:
Can i define a Bundle-Localization path which is outside the plugin, like

Bundle-Localization: ../properties/application

It seems, that the ManifestLocalization object which is searching for the properties file path, does ask ZipFile for the path. And ZipPath does not support this functionality.

How can i solve this issue?

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

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

发布评论

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

评论(1

蝶…霜飞 2024-07-24 15:18:40

不,您不能定义插件外部的路径。 尽管除了捆绑之外还考虑了片段。

一般来说,捆绑包不绑定到磁盘上的位置,因此您无法真正定义像 ../properties 这样的路径应该解析到的位置。 例如,考虑使用安装的捆绑包
BundleContext#installBundle(字符串位置,InputStream 输入)。 位置参数是包的标识,并且没有与其相关的语义。 包的内容是从输入流中读出的。 那么捆绑包之外的路径意味着什么呢?

No you can't define a path which is outside the plug-in. Though fragments are considered in addition to the bundle.

In general, bundles aren't tied to a location on disk so you can't really define where a path like ../properties should resolve to. Consider for example a bundle installed using
BundleContext#installBundle(String location, InputStream input). The location parameter is the identity of the bundle and there are no semantics tied to it. The content of the bundle is read out of the input stream. What would a path outside of the bundle mean then?

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