I want to implement internationalization in JSF, most of the techniques given on net involves asking a user his/her locale and setting the value in a session bean. But i want the locale to be set based on the request accept-language header and JSF should have some filter in place which sets the locale prior to the loading of the first page and then sets it in the language session beans which i can reuse like .
Thus is there some Locale filter like functionality implemented with jsf which can be used to set the Locale?
Thanks!
The locale should be detected automatically by a Java EE application if you have configured it correctly in your faces-config.xml and have the correct resource bundle files. This tutorial from Netbeans gives a good introduction.
Additionally, a web application can detect the client’s locale based on the request as by this quote from the Java EE tutorial:
There is also an example how to use the getLocale method:
You can put it in session state to have easy access.