G
gbattine
Hi guys,
i'm trying to solve this problem but nothing!!!!
I've a jsf application with 2 languages,italian(default )and english.
I have an italian resource bundle and an english one.
When i run the application and i select in a page english versione,all
the pages became in english,but application message like validator msg
etc....are still in italian!!
In my bean i've
Locale
locale=getFacesContext().getExternalContext().getRequestLocale();
System.out.println(locale);
ResourceBundle rb =
ResourceBundle.getBundle("microarray.bundle.messageResource", locale);
String result = rb.getString("groupPresent");
System.out.println(result);[/code
when i'm in english mode and i click on a submit botton i see
it
the message in italian,
because the locale it retrieves is ITALIAN, so the message is in
italian.
But i'm in english mode!!!!!!!
This is my faces config.xml
i'm trying to solve this problem but nothing!!!!
I've a jsf application with 2 languages,italian(default )and english.
I have an italian resource bundle and an english one.
When i run the application and i select in a page english versione,all
the pages became in english,but application message like validator msg
etc....are still in italian!!
In my bean i've
Locale
locale=getFacesContext().getExternalContext().getRequestLocale();
System.out.println(locale);
ResourceBundle rb =
ResourceBundle.getBundle("microarray.bundle.messageResource", locale);
String result = rb.getString("groupPresent");
System.out.println(result);[/code
when i'm in english mode and i click on a submit botton i see
it
the message in italian,
because the locale it retrieves is ITALIAN, so the message is in
italian.
But i'm in english mode!!!!!!!
This is my faces config.xml
Code:
<application>
<message-bundle>microarray.bundle.messageResource</message-bundle>
<locale-config>
<default-locale>it</default-locale>
<supported-locale>it</supported-locale>
<supported-locale>en</supported-locale>
</locale-config>
</application>
and this is my method to populate dropdown list of locales...please
help me...
public List getSupportedtLocaleItems()
{
if (localeItems == null)
{
localeItems = new ArrayList();
Application app =
FacesContext.getCurrentInstance().getApplication();
for (Iterator i = app.getSupportedLocales(); i.hasNext(); )
{
Locale locale = (Locale)i.next();
SelectItem item = new SelectItem(locale.toString(),
locale.getDisplayName());
localeItems.add(item);
}
if (localeItems.size() == 0)
{
Locale defaultLocale = app.getDefaultLocale();
localeItems.add(new SelectItem(defaultLocale.toString(),
defaultLocale.getDisplayName()));
}
}
return localeItems;
}
public String getLocale()
{
return
FacesContext.getCurrentInstance().getViewRoot().getLocale().toString();
}
public void setLocale(String locale)
{
FacesContext.getCurrentInstance().getViewRoot().setLocale(new
Locale(locale));
}