There is another problem, according to java API, the resource bundle is is loaded in 
following order (language1, country1 is the specified locale; language2 and country 2 
is the default locale of the Java Virtual Machine). 


baseName + "_" + language1 + "_" + country1 + "_" + variant1
baseName + "_" + language1 + "_" + country1
baseName + "_" + language1
baseName + "_" + language2 + "_" + country2 + "_" + variant2
baseName + "_" + language2 + "_" + country2
baseName + "_" + language2
baseName


If the JVM is running with chinese locale and there is a resource for chinese locale.
If the client's first preference is not supported by server,  no matter how the client 
specifies the other preference, the chinese locale is always selected by the original 
code. To fix this problem, we should change the code to


    377             // If nothing is right we will endup with en_US locale.
    378             Locale preferedLocale = Locale.US;
    379             for (Enumeration e = req.getLocales();e.hasMoreElements();)
    380             {
    381                Locale requestedLocale = (Locale)e.nextElement();
    382                ResourceBundle requestedResourceBundle = getResourceBundl    383
    384                // If there is an exact match, return it
    385                if (requestedResourceBundle.getLocale().equals(requestedL    
386                {
    387                    preferedLocale = requestLocale;
    388                    break;
    389                }
    390                // Ensure we do not return the bundle for default locale
    391                // when mismatch occur
    392                if (requestedResourceBundle.getLocale().equals(Locale.get    
393                {
    394                    continue;
    395                }
    396                // It returns Locale.US if tmpLocale is not supported
    397                if (!requestedResourceBundle.getLocale().equals(Locale.US    
398                {
    399                   preferedLocale = requestedLocale;
    400                   break;
    401                }


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

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


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to