前端时间遇到了一点问题,在中文、英文 版式切换的时候,大部分中文都可以国际化成英文,分别读取各自的ApplicationResource_zh.property 和ApplicationResource_en.property文件。但是,程序中有个信息提示,用于在用户操作后提示信息(例如:保存成功、更改成功),却怎么也不能读取到英文的资源文件。后来同事高手修改了。现记录下来修改方法,供自己备份学习。
switch((new Integer(language)).intValue()){
case 0 :
request.getSession().setAttribute(Globals.LOCALENAME_KEY, Locale.CHINA);
request.getSession().setAttribute(org.apache.struts.Globals.LOCALE_KEY, Locale.CHINA);
break;
case 1:
request.getSession().setAttribute(Globals.LOCALENAME_KEY, Locale.ENGLISH);
request.getSession().setAttribute(org.apache.struts.Globals.LOCALE_KEY, Locale.ENGLISH);
break;
default:
request.getSession().setAttribute(Globals.LOCALENAME_KEY, Locale.CHINA);
request.getSession().setAttribute(org.apache.struts.Globals.LOCALE_KEY, Locale.CHINA);
break;
}
注意红色字体为同事修改增加的部分!
switch((new Integer(language)).intValue()){
case 0 :
request.getSession().setAttribute(Globals.LOCALENAME_KEY, Locale.CHINA);
request.getSession().setAttribute(org.apache.struts.Globals.LOCALE_KEY, Locale.CHINA);
break;
case 1:
request.getSession().setAttribute(Globals.LOCALENAME_KEY, Locale.ENGLISH);
request.getSession().setAttribute(org.apache.struts.Globals.LOCALE_KEY, Locale.ENGLISH);
break;
default:
request.getSession().setAttribute(Globals.LOCALENAME_KEY, Locale.CHINA);
request.getSession().setAttribute(org.apache.struts.Globals.LOCALE_KEY, Locale.CHINA);
break;
}
注意红色字体为同事修改增加的部分!