How do we detect browser locale in struts2? I’ve language drop-down in website. Now, how to detect what language user ha selected in Struts2?
I’ve loginaction.java which extends AwareBaseAction, how can I detect user browser locale in loginaction.java?
Any sample code in Java is much appreciated.
Thanks!
The localization docs cover the different ways to process language selection. (See also the I18N interceptor page and How do we change locales FAQ entry.)
In addition, you can access the request’s local via the standard getLocale()/getLocales() methods and process them differently if necessary.