Internationalization & Localization issue
- by Ahmad
Hi all,
My application supports internationalization and localization, each user can choose his preference language and the application will reflect it perfectly. the issue is when the first user selects English and the second one selects French the resource bundle for the first user will read from the French resource after refreshing his page.
I am using the following code to change between the two languages:
public void changeToEnglish()
{
FacesContext context = FacesContext.getCurrentInstance();
Locale currentLocale = context.getViewRoot().getLocale();
String locale = "en_US";
Locale newLocale = new Locale(locale);
if(!currentLocale.equals(newLocale))
context.getViewRoot().setLocale(newLocale);
}
I have the following in my faces_config.xml:
<locale-config>
<default-locale>en</default-locale>
<supported-locale>fr</supported-locale>
</locale-config>
the application respond very well to changing languages but I think when setting the locale from the FacesContext it reflects all the users locales.
Please help me on this....