You should say something more in what why do you collect from request information about user preffered local but lets say that you get it from header accept-language
Then, as JSF specification says:
The UIViewRoot’s Locale is determined and set by the ViewHandler during the execution of the
ViewHandler’s createView() method. This method must cause the active Locale to be
determined by looking at the user’s preferences combined with the application’s stated supported locales.
So one thing is to set Locale in ViewRoot and to collect Locale from request header and another thing is to proper set supported locales in your config file.
In other part of specification you can read (see ViewHandler calculateLocale
method):
Method Application.getSupportedLocales() defines what locales this JSF application is capable of supporting. This method should match such sources of data up and return the Locale object that is the best choice for rendering the current application to the current user.
Why is it going in such way? Because you cannot send response to user with locale preffered by user if your apps isn't supported to send respond with that locale.
Now all you have to do (I hope so) is to configure your faces-config.xml
in WEB-INF
directory like this (also copied from JSF Specification):
<faces-config>
<application>
<locale-config>
<default-locale>en</default-locale>
<supported-locale>de</supported-locale>
<supported-locale>fr</supported-locale>
<supported-locale>es</supported-locale>
// ...
</locale-config>
</application>
</faces-config>