public static final class LocaleMatcher.Builder extends Object
LocaleMatcher.builder()
Modifier and Type | Method and Description |
---|---|
LocaleMatcher.Builder |
addSupportedLocale(Locale locale)
Adds another supported locale.
|
LocaleMatcher.Builder |
addSupportedULocale(ULocale locale)
Adds another supported locale.
|
LocaleMatcher |
build()
Builds and returns a new locale matcher.
|
LocaleMatcher.Builder |
internalSetThresholdDistance(int thresholdDistance)
Deprecated.
This API is ICU internal only.
|
LocaleMatcher.Builder |
setDefaultLocale(Locale defaultLocale)
Sets the default locale; if null, or if it is not set explicitly,
then the first supported locale is used as the default locale.
|
LocaleMatcher.Builder |
setDefaultULocale(ULocale defaultLocale)
Sets the default locale; if null, or if it is not set explicitly,
then the first supported locale is used as the default locale.
|
LocaleMatcher.Builder |
setDemotionPerDesiredLocale(LocaleMatcher.Demotion demotion)
Option for whether all desired locales are treated equally or
earlier ones are preferred (this is the default).
|
LocaleMatcher.Builder |
setFavorSubtag(LocaleMatcher.FavorSubtag subtag)
If SCRIPT, then the language differences are smaller than script differences.
|
LocaleMatcher.Builder |
setSupportedLocales(Collection<Locale> locales)
Copies the supported locales, preserving iteration order.
|
LocaleMatcher.Builder |
setSupportedLocales(String locales)
Parses the string like
LocalePriorityList does and
sets the supported locales accordingly. |
LocaleMatcher.Builder |
setSupportedULocales(Collection<ULocale> locales)
Copies the supported locales, preserving iteration order.
|
String |
toString() |
public LocaleMatcher.Builder setSupportedLocales(String locales)
LocalePriorityList
does and
sets the supported locales accordingly.
Clears any previously set/added supported locales first.locales
- the string of locales to set, to be parsed like LocalePriorityList doespublic LocaleMatcher.Builder setSupportedULocales(Collection<ULocale> locales)
locales
- the list of localespublic LocaleMatcher.Builder setSupportedLocales(Collection<Locale> locales)
locales
- the list of localepublic LocaleMatcher.Builder addSupportedULocale(ULocale locale)
locale
- another localepublic LocaleMatcher.Builder addSupportedLocale(Locale locale)
locale
- another localepublic LocaleMatcher.Builder setDefaultULocale(ULocale defaultLocale)
defaultLocale
- the default localepublic LocaleMatcher.Builder setDefaultLocale(Locale defaultLocale)
defaultLocale
- the default localepublic LocaleMatcher.Builder setFavorSubtag(LocaleMatcher.FavorSubtag subtag)
subtag
- the subtag to favorpublic LocaleMatcher.Builder setDemotionPerDesiredLocale(LocaleMatcher.Demotion demotion)
demotion
- the demotion per desired locale to set.@Deprecated public LocaleMatcher.Builder internalSetThresholdDistance(int thresholdDistance)
thresholdDistance
- the thresholdDistance to set, with -1 = defaultpublic LocaleMatcher build()
Copyright ? 2016 Unicode, Inc. and others.