I have a situation where when a user selects a language from a drop down, I want the the application locale to change accordingly. Capturing locale is not difficult, but how to set the locale for all pages there after.

From the docs for calculateLocale "Returns an appropriate Locale to use for this and subsequent requests for the current client." so does this means if a locale is calculated for a view and user changes locale, since locale for this view is already calculated so it will use the pre calculated and show the same view as before the locale changed ? I tested this scenario, at times calculateLocale is not called for a view if already calculated. Is Application.setDefaultLocale of any use in such a scenario.
–
gbaggaJan 20 '11 at 14:09

Application.setDefaultLocale() sets default locale accross the whole Application, that is for all users. I doubt this is a good idea.
–
Paweł DydaJan 22 '11 at 14:43

thanks for time .... something I wont likely try to do at this stage (some restrictions cant mention..) will keep a note of it ..
–
gbaggaJan 20 '11 at 10:12

From the docs for calculateLocale "Returns an appropriate Locale to use for this and subsequent requests for the current client." so does this means if a locale is calculated for a view and user changes locale, since locale for this view is already calculated so it will use the pre calculated and show the same view as before the locale changed ? I tested this scenario, at times calculateLocale is not called for a view if already calculated. Is Application.setDefaultLocale of any use in such a scenario
–
gbaggaJan 20 '11 at 14:10

I just went through this, and it's not difficult to code, but takes a bit to figure out how to do effectively in a future-proof and automated fashion, but I think I have a reasonable approach that automatically detects what languages are configured in JSF, and that localizes the menu items to the current Locale automatically.

First, make sure you're using a facelets template of some sort, or you're going to have to replicate this first part on every page you use. You set the Locale using the f:view locale= parameter

Would you care to elaborate on why you think it should look that way, instead of using JSF Converters and presenting the language selection in the current Locale? This seems to be a very low quality comment otherwise.
–
SplinterRealityDec 24 '13 at 0:38