我有一个多语言的struts应用程序,最近我将struts从2.3.20升级到2.3.29。升级后,泰米尔语不起作用,即使我们选择泰米尔语言,文本也会以英文显示。泰米尔语言选项不支持struts 2.3.29
我在选择泰米尔语言时检查了语言环境设置,它是正确的,即request_locale = ta_IN。
我试着在我的自定义拦截器类中扩展I18nInterceptor,然后覆盖如下的方法getLocaleFromParam()
方法。这也没有奏效。
所以,请让我知道你是否有任何解决这个问题的方法。
泰米尔语在Struts的2.3.20做工精细
protected Locale getLocaleFromParam(Object requestedLocale)
{
Locale locale = null;
if (requestedLocale != null) {
locale = (requestedLocale instanceof Locale) ?
(Locale) requestedLocale :
LocalizedTextUtil.localeFromString
(requestedLocale.toString(), null);
if (locale != null) {
logger.debug("applied request locale="+locale);
}
}
return locale;
}
的代码似乎是正确的,你是怎么加入这个拦截到STRUST?你删除了struts的默认'i18n'拦截器吗? –
请参考http://stackoverflow.com/questions/36245849/struts-2-version-2-3-28-only-accepts-registered-locales –
@AlirezaFattahi我提到了重写getLocaleFromParam()方法的问题。我们如何使用未在JVM中注册的区域设置。我没有删除默认堆栈。新的拦截器代码如下。 <拦截> <拦截器名称= “langSelInterceptor” \t类= “com..LangInter”> 拦截> <拦截器堆栈名称= “newStack”> <拦截器参考名称= “langSelInterceptor” /> <拦截器参考名称= “defaultStack”/> 拦截堆叠> 拦截> <动作名称= “loginTamilLocale” 类= “com.Action”> <拦截-REF名称= “newStack”/> –