Question

I want to know how to get request locale in OGNL?

For now I use

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

This must assume that the initial value is "zh_CN".

So I need to know how to get request locale in OGNL.

Thx

Was it helpful?

Solution

#request.locale

OTHER TIPS

#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>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top