简体   繁体   English

不带faces-config的JSF 2.0国际化

[英]JSF 2.0 internationalization without faces-config

I want to provide different languages in my jsf-application. 我想在我的jsf应用程序中提供不同的语言。

I've found that explanation and I wonder if I can also do that without faces-config (because I don't use one since jsf2 has annotations). 我已经找到了这种解释,并且我想知道是否也可以不用faces-config来做到这一点(因为由于jsf2具有注释,所以我不使用它)。

Can I do it another way? 我可以换一种方式吗? Or do I have to create a faces-config.xml ? 还是我必须创建一个faces-config.xml?

Thank you for help :-) cheers 谢谢您的帮助:-)欢呼

创建一个最小的faces-config.xml与i18n相关的几个conf,然后继续阅读jsf-2-internationalization-example

I am afraid that you cannot avoid faces-config.xml. 恐怕您不能避免使用faces-config.xml。 However, that is not such a big deal. 但是,这没什么大不了的。

If you are using Eclipse you can install JBoss Tools . 如果使用的是Eclipse,则可以安装JBoss Tools Then you can simply right click with your mouse on a project -> Configure -> Add JSF capabilities. 然后,您只需在项目上单击鼠标右键->配置->添加JSF功能。 It will allow you to easy externalize strings from your JSF page - simply select string that you want to be localized, right click and choose "Externalize Strings...". 它使您可以轻松地从JSF页面外部化字符串-只需选择要本地化的字符串,右键单击并选择“外部化字符串...”。 It will allow you to set up (create) properties file automatically. 它将允许您自动设置(创建)属性文件。 It also suggest translation variable and resource key while you type, very nice feature. 它还在您输入时建议翻译变量和资源键,这是非常不错的功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM