Class XLocaleUtils
java.lang.Object
de.xima.fc.common.utils.XLocaleUtils
Utility class for locale related operations.
- Since:
- 8.2.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceA predicate on a locale. -
Method Summary
Modifier and TypeMethodDescriptionstatic Comparator<Locale> comparingLocaleByDisplayName(Locale locale) Compares two locales by their display name in the given locale, ignoring case.static StringgetDisplayName(Locale locale, Locale viewLocale) Gets the display name of a locale in the given view locale, or the default display name if the view locale is null.static StringlocaleBaseLanguage(Locale locale) Gets the base language of a locale, returning an empty string if the locale is null.static LocaletoBaseLocale(Locale locale) Converts a locale to a base locale, stripping off the country and variant.
-
Method Details
-
comparingLocaleByDisplayName
Compares two locales by their display name in the given locale, ignoring case.- Parameters:
locale- The locale to use for obtaining each locale's display name.- Returns:
- A comparator that compares two locales by their display name in the given locale.
-
getDisplayName
Gets the display name of a locale in the given view locale, or the default display name if the view locale is null.- Parameters:
locale- The locale to get the display name of.viewLocale- The locale to use for obtaining the display name.- Returns:
- The display name of the locale.
-
localeBaseLanguage
-
toBaseLocale
-