Sorry the proposed fix still has subtle bugs.

What we really want is the following order of lookup resource bundles


baseName+"_"+language1+"_"+country1+"_"+variant1
baseName+"_"+language1+"_"+country1
baseName+"_"+language1
baseName+"_"+language2+"_"+country2+"_"+variant2
baseName+"_"+language2+"_"+country2
baseName+"_"+language2
....
baseName+"_"+defaultLanguage+"_"+defaultCountry+"_"+defualtVariant
baseName+"_"+defaultLanguage+"_"+defaultCountry
baseName+"_"+defaultLanguage


Where language1,country1,variant1 is the first prefered locale;
language2,country2,variant2 is the second prefered locale; ....
when no prefered locale is supported by the server we use a designated default locale. 
(We can not use the default locale of JVM, which is JVM specific. The current approach 
is to handed code it to be en_US, which works fine).
The following code will correctly implement the above order of searching.


    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                String requestedLanguage = requestLocale.getLanguage();
    383                ResourceBundle requestedResourceBundle = bundles.get(locale);
    384                if (requestedResourceBundle != null)
    385                {
    386                    Locale actualLocale = requestedResourceBundle.getLocale();
    387                    String actualLanguage = actualLocale.getLanguage();
    388                    if (actualLanguage.equals(requestedLanguage)) {
    389                        preferedLocale = requestedLocale;
    390                        break;
    391                    }
    392                }
    393             }


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

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


-------------------------------------------------------
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