It never ends.... ;-)

in LocaleSelector.setLocale() you do this

  | ...
  | set locale based on language and so on...
  | ...
  | else
  |       {
  |          locale = java.util.Locale.getDefault();
  |          FacesContext facesContext = FacesContext.getCurrentInstance();
  |          if (facesContext!=null)
  |          {
  |             java.util.Locale defaultLocale = 
facesContext.getApplication().getDefaultLocale();
  |             if (defaultLocale!=null) locale = defaultLocale;
  |             java.util.Locale requestLocale = 
facesContext.getExternalContext().getRequestLocale();
  |             if (requestLocale!=null) locale = requestLocale;
  |          }
  |       }
  | 

this has the effect that the browser locale overrides the default application 
locale from faces-config.xml even though it is not listed in "supported 
locales".

with these bundles

  | messages.properties (happens to be in en_US)
  | messages_sv_SE.properties
  | messages_de_DE.properties
  | 

and this in faces-config.xml

  |  <locale-config>
  |    <default-locale>de_DE</default-locale>
  |    <supported-locale>de_DE</supported-locale>
  |    <supported-locale>en_US</supported-locale>
  |    <supported-locale>sv_SE</supported-locale>
  |   </locale-config>
  | 

If someone now comes along with a browser with the locale set to es_MX (mexican 
spanish) setLocale() (as of now) would be perfectly happy with the 
requestLocale but when java tries to find a resource bundle matching it, it 
would fall back on messages.properties (english) although the person who 
deployed the app said it should be messages_de_DE.properties (german). So 
setLocale() should only be happy with the requestLocale if it is in the list of 
supported locales.

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3929535#3929535

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3929535


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to