使用 Seam 2.2.2 实现国际化
我有一个 jboss seam 2.2.2 项目,这是我第一次使用这个框架的国际化。我已经设置了默认区域设置,并且使用全局 messages_XX.properties 已经可以工作。 嗯,这个项目正在快速增长,为了更好的组织和易于维护,我希望将消息更好地组织在特定页面的各种属性文件中。 有关国际化的 Seam 文档 提及这段话和一个具体段落说:
如果您想仅为特定页面定义消息,您可以 在与 JSF 视图 id 同名的资源包中指定它, 删除前导 / 和尾随文件扩展名。所以我们可以 如果我们只需要,请将我们的消息放入welcome/hello_en.properties 在 /welcome/hello.jsp 上显示消息
该段落可以在以下位置找到:http://docs.jboss.org/seam/2.2.2.Final/reference/en-US/html/i18n.html#d0e14166
文档提到带有 .jsp 扩展名的页面,但是就我而言,我使用的是 Facelets,我拥有的是 .xhtml 文件,因此对于我的 home.xhtml 页面,我创建了一个 home_pt_BR.properties 文件,默认为 pt_BR我的应用程序的区域设置,我已在此 .properties 文件中放置此特定页面的消息。
事实上这个方法对我来说并不起作用。
我还尝试在 faces-config.xml 和 Pages.xml 中注册页面,但这似乎不起作用。
那么,如何配置 Seam 以支持我的应用程序的多个捆绑文件?
I have a jboss seam 2.2.2 project and it is my first time using internationalization with this framework. I have already set the default locale and using the global messages_XX.properties is already working.
Well, this project is growing fast and for better organization and for ease of maintance I would like to have the messages better organized in various properties files for specific pages.
Seam documentation on internationalization mention this and in a specific paragraph it says:
If you want to define a message just for a particular page, you can
specify it in a resource bundle with the same name as the JSF view id,
with the leading / and trailing file extension removed. So we could
put our message in welcome/hello_en.properties if we only needed to
display the message on /welcome/hello.jsp
This paragraph can be found at: http://docs.jboss.org/seam/2.2.2.Final/reference/en-US/html/i18n.html#d0e14166
The docs mention pages with .jsp extension but in my case I am using facelets and what I have is a .xhtml file so for my home.xhtml page I have created a home_pt_BR.properties file being pt_BR the default locale for my app and I have placed messages for this specific page in this .properties file.
Actually this approach did not work for me.
I have also tryed to register the page in faces-config.xml and also in pages.xml but again this does not seem to work.
So, how do I configure Seam to support multiple bundle files for my application?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以将捆绑文件添加到 Components.xml
例如:
You could add the bundle files to components.xml
For example: