how can i determine the current language of the running application in spring controller?
I need it to know which language to pass for the messageresource.getmessage..
thx very much
Printable View
how can i determine the current language of the running application in spring controller?
I need it to know which language to pass for the messageresource.getmessage..
thx very much
I suggest a read of the I18N chapter in the reference guide... Also in general you want spring to handle the getting of the message instead of you doing that...
Come on guys... its not like i didnt do that. ive read http://static.springsource.org/sprin...-messagesource and http://static.springsource.org/sprin...-messagesource. I dont see an example of how to determine the current language. only MessageSource handling, which i already knew.
Can you please just tell me ?
thx
As I stated read the reference guide (http://static.springsource.org/sprin...localeresolver) use a locale resolver...
thx your right. i was at the wrong place :)
If your controller is an annotated @Controller, simply declare method parameter of type java.util.Locale and it will be resolved to "the current request locale (determined by the most specific locale resolver available, i.e. the configured LocaleResolver in a Servlet environment)."
how about doing :
regards,Code:if (LocaleContextHolder.getLocale().getDisplayLanguage() =="English")
Emil