Package org.xwiki.localization
Class LocaleUtils
- java.lang.Object
-
- org.apache.commons.lang3.LocaleUtils
-
- org.xwiki.localization.LocaleUtils
-
public class LocaleUtils extends org.apache.commons.lang3.LocaleUtilsExtendsLocaleUtilswith more tools.- Since:
- 5.1RC1
- Version:
- $Id: f41368dd83ab79f2b0d1e9d915aaa75ddf5538fb $
-
-
Constructor Summary
Constructors Constructor Description LocaleUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static LocalegetParentLocale(Locale locale)static LocaletoLocale(String str)ExtendsLocaleUtilswhich returnLocale.ROOTfor an empty string.static LocaletoLocale(String str, Locale fallback)Same astoLocale(String)but it never throws an exception.
-
-
-
Method Detail
-
getParentLocale
public static Locale getParentLocale(Locale locale)
- Parameters:
locale- the locale- Returns:
- the parent locale
-
toLocale
public static Locale toLocale(String str)
ExtendsLocaleUtilswhich returnLocale.ROOTfor an empty string.- Parameters:
str- the locale String to convert, null returns null- Returns:
- a Locale, null if null input
- Throws:
IllegalArgumentException- if the string is an invalid format- Since:
- 5.2M1
-
toLocale
public static Locale toLocale(String str, Locale fallback)
Same astoLocale(String)but it never throws an exception. It returns the passed fallback locale in case the given string locale has an invalid format.- Parameters:
str- the locale string to convert, null returns nullfallback- the locale to return as fallback in case the given locale string has an invalid format- Returns:
- a Locale, null if null input
- Since:
- 6.0M1
- See Also:
toLocale(String)
-
-