- final String country = locale.getCountry();
- sb.append(baseName).append('_').append(language);
- String name = sb.toString();
-
- if (country.length() != 0)
- {
- bundle = tryBundle(name, new Locale(language),
- classloader, bundle, cache);
- sb.append('_').append(country);
- name = sb.toString();
-
- final String variant = locale.getVariant();
-
- if (variant.length() != 0)
- {
- bundle = tryBundle(name, new Locale(language, country),
- classloader, bundle, cache);
- sb.append('_').append(variant);
- name = sb.toString();
- }
- }
- bundle = tryBundle(name, locale, classloader, bundle, cache);
+ sb.append(language);
+ bundle = tryBundle(sb.toString(), new Locale(language),
+ classloader, bundle, cache);
+ }
+ // If LANGUAGE was empty, we still need to try the other
+ // components, and the `_' is required.
+ sb.append('_');
+
+ if (country.length() > 0)
+ {
+ sb.append(country);
+ bundle = tryBundle(sb.toString(), new Locale(language, country),
+ classloader, bundle, cache);
+ }
+ sb.append('_');
+
+ if (variant.length() > 0)
+ {
+ sb.append(variant);
+ bundle = tryBundle(sb.toString(), locale,
+ classloader, bundle, cache);