ApplicationRessource.properties文件是否可以位于EN之外的其他本地

时间:2015-10-22 21:18:17

标签: struts2 localization

Struts2文件applicationRessource.properties是否可以使用英语以外的其他语言环境。我知道我可以使用其他文件,例如ApplicationRessource_fr.propertiesApplicationRessource_es.properties

我的主要问题仅涉及ApplicationRessource.properties。我的默认语言是法语,我不想拥有像ApplicationRessource_fr.properties这样的文件。有没有办法做到这一点?

2 个答案:

答案 0 :(得分:0)

如果要使用法语区域设置,则必须有ApplicationRessource_fr.properties之类的文件。您还可以使用默认语言文件,如果未请求区域设置,将使用该文件。应用程序的基本部分包括截取请求的区域设置的拦截器,您还可以根据请求切换区域设置。

  

动作堆栈上可能没有i18n拦截器,或者你没有   已使用的语言环境或默认语言环境的资源包   JVM。

Essentially, the i18n Interceptor pushes a locale into the ActionContext map upon every request. The framework components that
support localization all utilize the ActionContext locale.

答案 1 :(得分:0)

这是我们找到的解决方案。我们使用3个文件。法语的ApplicationRessource.properties,空的ApplicationRessource_fr.properties和包含英语翻译的ApplicationRessource_en.properties