java国际化,中文支持,通过ApplicationResources.properties实现
具体过程:
1、配置
在struts配置文件中配置:
<message-resources parameter="ApplicationResources"/>(没有指定key属性,因此是默认的 Resource Bundle 他的资源文件为ApplicationResources.properties) <message-resources parameter="SpecialResources" key="special"/>,指定key属性为“special”,他的资源文件为 SpecialResources.properties.
或在web.xml中配置:
<init-param> <param-name>application</param-name> <param-value>ApplicationResources</param-value> </init-param>
2、资源文件制作
ApplicationResources.properties文件制作
建立app.properties,内容可以如下:
mfsoft.login.username=用户名:
建立一个bat文件,内容如下:
native2ascii -encoding gb2312 app.properties app_cn.properties
执行bat文件之后得到app_cn.properties,内容如下:
mfsoft.login.username=\u7528\u6237\u540d\uff1a