public class LocalizationUtils
extends java.lang.Object
| Constructor and Description |
|---|
LocalizationUtils() |
| Modifier and Type | Method and Description |
|---|---|
protected static ILocalized[] |
filter(ILocalized[] elements,
java.util.List<com.ibm.icu.util.ULocale> locales)
Filters a set of elements using the locales and returns a copy of the array
containing only elements that match the locales, or that are not localized
if there are no matches
|
protected static java.util.List<com.ibm.icu.util.ULocale> |
getDefaultLocaleList()
Gets the default locales list
|
protected static ILocalized |
getLocalizedElement(ILocalized[] elements,
java.lang.String[] locales)
Returns the first (best) match for an element given the set of locales, or null
if there are no suitable elements.
|
static ILocalized |
getLocalizedElement(ILocalized[] elements,
java.lang.String[] locales,
java.lang.String defaultLocale)
Returns the first (best) match for an element given the set of locales, or will fall back to the
match for defaultLocale if there are no suitable matches, and then to null
if there are no elements at all.
|
static java.util.List<com.ibm.icu.util.ULocale> |
getProcessedLocaleList(java.lang.String[] locales)
Converts an array of language tags to a list of ULocale instances
ordered according to priority, availability and fallback
rules.
|
static boolean |
isValidLanguageTag(java.lang.String tag)
Validates a given language tag.
|
static ILocalized[] |
processElementsByDefaultLocales(ILocalized[] elements)
Sorts an array of localized elements using default locales (*).
|
protected static ILocalized[] |
processElementsByLocales(ILocalized[] elements,
java.lang.String[] locales)
Filters and sorts a list of localized elements using the given locale list; only localized elements
are returned unless no appropriate localized elements are found, in which case nonlocalized elements
are returned
|
static ILocalized[] |
processElementsByLocales(ILocalized[] elements,
java.lang.String[] locales,
java.lang.String defaultLocale)
Filters and sorts a list of localized elements using the given locale list; only localized elements
are returned unless no appropriate localized elements are found, in which case nonlocalized elements
are returned.
|
public static ILocalized getLocalizedElement(ILocalized[] elements, java.lang.String[] locales, java.lang.String defaultLocale)
elements - locales - defaultLocale - the default locale in case none of the supplied locales provide a matchprotected static ILocalized getLocalizedElement(ILocalized[] elements, java.lang.String[] locales)
elements - locales - public static ILocalized[] processElementsByLocales(ILocalized[] elements, java.lang.String[] locales, java.lang.String defaultLocale)
elements - locales - defaultLocale - the default locale in case none of the supplied locales provide a matchprotected static ILocalized[] processElementsByLocales(ILocalized[] elements, java.lang.String[] locales)
elements - locales - public static ILocalized[] processElementsByDefaultLocales(ILocalized[] elements)
protected static ILocalized[] filter(ILocalized[] elements, java.util.List<com.ibm.icu.util.ULocale> locales)
elements - locales - public static java.util.List<com.ibm.icu.util.ULocale> getProcessedLocaleList(java.lang.String[] locales)
locales - protected static java.util.List<com.ibm.icu.util.ULocale> getDefaultLocaleList()
public static boolean isValidLanguageTag(java.lang.String tag)
tag - 2012 Apache Software Foundation.