资源包java
是否可以在类似于以下内容的文件夹结构中维护资源包;
1. us\en
2. ae\en
3. ae\ar
资源包文件名将相同,但维护在不同的文件夹中。我知道Java推荐
myresource_en_US.properties
但我需要将它们维护在文件夹中并使用资源包类来访问。我正在使用 JDK 6。有谁知道我该怎么做?
Is it possible to maintain the resource bundle in a folder structure something similar to the following;
1. us\en
2. ae\en
3. ae\ar
The resource bundle file name will be the same but maintained in different folders. I know Java recomends
myresource_en_US.properties
But I need to maintained them in folders and use the resource bundle classes to access. I am using JDK 6. Does anyone know how I can do it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,您可以使用自定义 < 来控制加载代码>控制。下面是一个启动示例:
(源代码是从默认实现复制的,仅更改了
resourceName
并将PropertyResourceBundle
更改为以 UTF-8 格式读取流--不再需要native2ascii),如下所示
另请参阅:
Yes, you can control the loading with a custom
Control
. Here's a kickoff example:(the source code is copied from the default implementation with only the
resourceName
changed and thePropertyResourceBundle
being changed to read the stream as UTF-8 --no need for native2ascii anymore)which you use as follows
See also:
看一下 http://download.oracle .com/javase/6/docs/api/java/util/ResourceBundle.Control.html。您可以将一个作为参数传递给
ResourceBundle.getBundle()
作为一种“在本地化资源的组织和打包中提供不同约定”的方式。Have a look at http://download.oracle.com/javase/6/docs/api/java/util/ResourceBundle.Control.html. You can pass one as an argument to
ResourceBundle.getBundle()
as a way "to provide different conventions in the organization and packaging of localized resources".