Struts2 国际化问题

来源:互联网 发布:权限管理 java 编辑:程序博客网 时间:2024/05/22 07:00

  Struts2 中 国际化中Properties命名的规则问题:

 

首先在struts.properties文件中加入以下内容:
struts.custom.i18n.resources=info
或在struts.xml中加入
<constant name="struts.custom.i18n.resources" value="info"></constant>

 如果想要在struts.properties 文件中配置,则代码需要做适当的修改:<constant name="struts.custom.i18n.resources" value="info"></constant> 需要更改成 key 和 value 的形式(struts.custom.i18n.resoures = info)。

这种系统级的变量,但是最好还是在struts.xml进行注册!!!

资源文件的命名格式: 名称_语言代码_国家代码. Properties
如果创建中文和英语国际化,那么资源文件名称为
info_zh_CN.properties和info_en_US.properties

原创粉丝点击