List of usage examples for org.apache.commons.lang LocaleUtils localeLookupList
public static List localeLookupList(Locale locale, Locale defaultLocale)
Obtains the list of locales to search through when performing a locale search.
localeLookupList(Locale("fr", "CA", "xxx"), Locale("en")) = [Locale("fr","CA","xxx"), Locale("fr","CA"), Locale("fr"), Locale("en"]
The result list begins with the most specific locale, then the next more general and so on, finishing with the default locale.
From source file:org.openengsb.core.api.l10n.BundleStrings.java
@Override public String getString(String key, Locale locale, String... parameters) { @SuppressWarnings("unchecked") List<Locale> locales = LocaleUtils.localeLookupList(locale, new Locale("")); for (Locale l : locales) { Properties p = entries.get(buildEntryFilename(l)); if (p == null) { continue; }/*from w ww . j a va 2s . c o m*/ if (p.containsKey(key)) { String property = p.getProperty(key); String format = MessageFormat.format(property, (Object[]) parameters); return format; } } return null; }