com.android.ide.common.resources
Class LocaleManager

java.lang.Object
  extended by com.android.ide.common.resources.LocaleManager

public class LocaleManager
extends java.lang.Object

The LocaleManager provides access to locale information such as language names and language to region name mappings for the various locales.


Method Summary
static LocaleManager get()
          Returns the LocaleManager singleton
static java.util.Set<java.lang.String> getLanguageCodes()
          Returns all the known language codes
static java.lang.String getLanguageName(java.lang.String languageCode)
          Returns the name of the given language for a language code, in English.
static java.util.Map<java.lang.String,java.lang.String> getLanguageNamesMap()
           
static java.lang.String getLanguageRegion(java.lang.String languageCode)
          Returns the region code for the given language.
static java.util.Map<java.lang.String,java.lang.String> getLanguageToCountryMap()
           
static java.util.Set<java.lang.String> getRegionCodes()
          Returns all the known region codes
static java.lang.String getRegionName(java.lang.String regionCode)
          Returns the name of the given region for a 2 letter region code, in English.
static java.util.Map<java.lang.String,java.lang.String> getRegionNamesMap()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

get

@NonNull
public static LocaleManager get()
Returns the LocaleManager singleton

Returns:
the LocaleManager singleton, never null

getRegionName

@Nullable
public static java.lang.String getRegionName(@NonNull
                                                      java.lang.String regionCode)
Returns the name of the given region for a 2 letter region code, in English.

Parameters:
regionCode - the 2 letter region code (ISO 3166-1 alpha-2)
Returns:
the name of the given region for a region code, in English, or null if not known

getLanguageName

@Nullable
public static java.lang.String getLanguageName(@NonNull
                                                        java.lang.String languageCode)
Returns the name of the given language for a language code, in English.

Parameters:
languageCode - the 2 letter language code (ISO 639-1)
Returns:
the name of the given language for a language code, in English, or null if not known

getLanguageCodes

@NonNull
public static java.util.Set<java.lang.String> getLanguageCodes()
Returns all the known language codes

Returns:
all the known language codes

getRegionCodes

@NonNull
public static java.util.Set<java.lang.String> getRegionCodes()
Returns all the known region codes

Returns:
all the known region codes

getLanguageRegion

@Nullable
public static java.lang.String getLanguageRegion(@NonNull
                                                          java.lang.String languageCode)
Returns the region code for the given language. Note that there can be many regions that speak a given language; this just picks one. Note that if the current locale of the user happens to have the same language as the given language code, in that case we pick the current region.

Parameters:
languageCode - the language to look up
Returns:
the corresponding region code, if any

getLanguageToCountryMap

public static java.util.Map<java.lang.String,java.lang.String> getLanguageToCountryMap()

getLanguageNamesMap

public static java.util.Map<java.lang.String,java.lang.String> getLanguageNamesMap()

getRegionNamesMap

public static java.util.Map<java.lang.String,java.lang.String> getRegionNamesMap()