Package com.ibm.icu.util
Class LocaleMatcher.Result
java.lang.Object
com.ibm.icu.util.LocaleMatcher.Result
- Enclosing class:
LocaleMatcher
Data for the best-matching pair of a desired and a supported locale.
-
Method Summary
Modifier and TypeMethodDescriptionint
Returns the index of the best-matching desired locale in the input Iterable orderReturns the best-matching desired locale.Returns the best-matching desired locale.int
Returns the index of the best-matching supported locale in the constructor’s or builder’s input order (“set” Collection plus “added” locales).Returns the best-matching supported locale.Returns the best-matching supported locale.Takes the best-matching supported locale and adds relevant fields of the best-matching desired locale, such as the -t- and -u- extensions.Takes the best-matching supported locale and adds relevant fields of the best-matching desired locale, such as the -t- and -u- extensions.
-
Method Details
-
getDesiredULocale
Returns the best-matching desired locale. null if the list of desired locales is empty or if none matched well enough.- Returns:
- the best-matching desired locale, or null.
-
getDesiredLocale
Returns the best-matching desired locale. null if the list of desired locales is empty or if none matched well enough.- Returns:
- the best-matching desired locale, or null.
-
getSupportedULocale
Returns the best-matching supported locale. If none matched well enough, this is the default locale. The default locale is null ifLocaleMatcher.Builder.setNoDefaultLocale()
was called, or if the list of supported locales is empty and no explicit default locale is set.- Returns:
- the best-matching supported locale, or null.
-
getSupportedLocale
Returns the best-matching supported locale. If none matched well enough, this is the default locale. The default locale is null ifLocaleMatcher.Builder.setNoDefaultLocale()
was called, or if the list of supported locales is empty and no explicit default locale is set.- Returns:
- the best-matching supported locale, or null.
-
getDesiredIndex
public int getDesiredIndex()Returns the index of the best-matching desired locale in the input Iterable order. -1 if the list of desired locales is empty or if none matched well enough.- Returns:
- the index of the best-matching desired locale, or -1.
-
getSupportedIndex
public int getSupportedIndex()Returns the index of the best-matching supported locale in the constructor’s or builder’s input order (“set” Collection plus “added” locales). If the matcher was built from a locale list string, then the iteration order is that of a LocalePriorityList built from the same string. -1 if the list of supported locales is empty or if none matched well enough.- Returns:
- the index of the best-matching supported locale, or -1.
-
makeResolvedULocale
Takes the best-matching supported locale and adds relevant fields of the best-matching desired locale, such as the -t- and -u- extensions. May replace some fields of the supported locale. The result is the locale that should be used for date and number formatting, collation, etc. Returns null if getSupportedLocale() returns null.Example: desired=ar-SA-u-nu-latn, supported=ar-EG, resolved locale=ar-SA-u-nu-latn
- Returns:
- a locale combining the best-matching desired and supported locales.
-
makeResolvedLocale
Takes the best-matching supported locale and adds relevant fields of the best-matching desired locale, such as the -t- and -u- extensions. May replace some fields of the supported locale. The result is the locale that should be used for date and number formatting, collation, etc. Returns null if getSupportedLocale() returns null.Example: desired=ar-SA-u-nu-latn, supported=ar-EG, resolved locale=ar-SA-u-nu-latn
- Returns:
- a locale combining the best-matching desired and supported locales.
-