Example usage for org.apache.commons.lang3 LocaleUtils localeLookupList

List of usage examples for org.apache.commons.lang3 LocaleUtils localeLookupList

Introduction

In this page you can find the example usage for org.apache.commons.lang3 LocaleUtils localeLookupList.

Prototype

public static List<Locale> localeLookupList(final Locale locale, final Locale defaultLocale) 

Source Link

Document

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.

Usage

From source file:org.xwiki.search.solr.internal.SolrIndexAvailableLocalesListener.java

/**
 * @param locale the locale//from w ww .  j av a  2  s  .co  m
 * @return the parents of the locale
 */
private Set<Locale> getParentLocales(Locale locale) {
    Set<Locale> parentLocales = new HashSet<Locale>(LocaleUtils.localeLookupList(locale, Locale.ROOT));

    parentLocales.remove(locale);

    return parentLocales;
}