How do I get the localization of a request in OGNL?

I want to know how to get the locale of a request in OGNL?

I am currently using

<s:set var="locale" value='#session.WW_TRANS_I18N_LOCALE?#session.WW_TRANS_I18N_LOCALE.toString():"zh_CN"'/>

      

This should assume the initial value is "zh_CN".

So I need to know how to get the localization of the request in OGNL.

thanks

+1


a source to share


2 answers


#request.locale

      



+4


a source


#request.locale

return java.util.Locale object

try



<s:if test="#request.locale.language=='en'">
  Current Locale is ENGLISH
</s:if>
<s:else test="#request.locale.language=='fr'">
  Current Locale is FRANCE
</s:else>

      

+1


a source







All Articles