Package com.ibm.icu.impl
Class LocaleIDs
- java.lang.Object
-
- com.ibm.icu.impl.LocaleIDs
-
public class LocaleIDs extends java.lang.Object
Utilities for mapping between old and new language, country, and other locale ID related names.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String[]
_countries
private static java.lang.String[]
_countries3
private static java.lang.String[]
_deprecatedCountries
private static java.lang.String[]
_languages
Tables used in normalizing portions of the id.private static java.lang.String[]
_languages3
private static java.lang.String[]
_obsoleteCountries
private static java.lang.String[]
_obsoleteCountries3
private static java.lang.String[]
_obsoleteLanguages
private static java.lang.String[]
_obsoleteLanguages3
private static java.lang.String[]
_replacementCountries
private static java.lang.String[]
_replacementLanguages
-
Constructor Summary
Constructors Constructor Description LocaleIDs()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static int
findIndex(java.lang.String[] array, java.lang.String target)
linear search of the string array.static java.lang.String
getCurrentCountryID(java.lang.String oldID)
static java.lang.String
getCurrentLanguageID(java.lang.String oldID)
static java.lang.String
getISO3Country(java.lang.String country)
Returns a three-letter abbreviation for the provided country.static java.lang.String
getISO3Language(java.lang.String language)
Returns a three-letter abbreviation for the language.static java.lang.String[]
getISOCountries()
Returns a list of all 2-letter country codes defined in ISO 3166.static java.lang.String[]
getISOLanguages()
Returns a list of all 2-letter language codes defined in ISO 639 plus additional 3-letter codes determined to be useful for locale generation as defined by Unicode CLDR.static java.lang.String
threeToTwoLetterLanguage(java.lang.String lang)
static java.lang.String
threeToTwoLetterRegion(java.lang.String region)
-
-
-
Field Detail
-
_languages
private static final java.lang.String[] _languages
Tables used in normalizing portions of the id.
-
_replacementLanguages
private static final java.lang.String[] _replacementLanguages
-
_obsoleteLanguages
private static final java.lang.String[] _obsoleteLanguages
-
_languages3
private static final java.lang.String[] _languages3
-
_obsoleteLanguages3
private static final java.lang.String[] _obsoleteLanguages3
-
_countries
private static final java.lang.String[] _countries
-
_deprecatedCountries
private static final java.lang.String[] _deprecatedCountries
-
_replacementCountries
private static final java.lang.String[] _replacementCountries
-
_obsoleteCountries
private static final java.lang.String[] _obsoleteCountries
-
_countries3
private static final java.lang.String[] _countries3
-
_obsoleteCountries3
private static final java.lang.String[] _obsoleteCountries3
-
-
Method Detail
-
getISOCountries
public static java.lang.String[] getISOCountries()
Returns a list of all 2-letter country codes defined in ISO 3166. Can be used to create Locales.
-
getISOLanguages
public static java.lang.String[] getISOLanguages()
Returns a list of all 2-letter language codes defined in ISO 639 plus additional 3-letter codes determined to be useful for locale generation as defined by Unicode CLDR. Can be used to create Locales. [NOTE: ISO 639 is not a stable standard-- some languages' codes have changed. The list this function returns includes both the new and the old codes for the languages whose codes have changed.]
-
getISO3Country
public static java.lang.String getISO3Country(java.lang.String country)
Returns a three-letter abbreviation for the provided country. If the provided country is empty, returns the empty string. Otherwise, returns an uppercase ISO 3166 3-letter country code.- Throws:
java.util.MissingResourceException
- Throws MissingResourceException if the three-letter country abbreviation is not available for this locale.
-
getISO3Language
public static java.lang.String getISO3Language(java.lang.String language)
Returns a three-letter abbreviation for the language. If language is empty, returns the empty string. Otherwise, returns a lowercase ISO 639-2/T language code. The ISO 639-2 language codes can be found on-line atftp://dkuug.dk/i18n/iso-639-2.txt
- Throws:
java.util.MissingResourceException
- Throws MissingResourceException if the three-letter language abbreviation is not available for this locale.
-
threeToTwoLetterLanguage
public static java.lang.String threeToTwoLetterLanguage(java.lang.String lang)
-
threeToTwoLetterRegion
public static java.lang.String threeToTwoLetterRegion(java.lang.String region)
-
findIndex
private static int findIndex(java.lang.String[] array, java.lang.String target)
linear search of the string array. the arrays are unfortunately ordered by the two-letter target code, not the three-letter search code, which seems backwards.
-
getCurrentCountryID
public static java.lang.String getCurrentCountryID(java.lang.String oldID)
-
getCurrentLanguageID
public static java.lang.String getCurrentLanguageID(java.lang.String oldID)
-
-