public final class JsfLocaleUtil extends Object
Modifier and Type | Method and Description |
---|---|
static Locale |
getCurrentLocale()
Convenience method to get the current locale from the view root.
|
static Locale |
getDefaultLocale()
Convenience method to get the default locale.
|
static List<Locale> |
getSupportedLocales()
Gets the supported locales.
|
static List<javax.faces.model.SelectItem> |
getSupportedLocalesAsListItems()
Gets the supported locales as a List of SelectItem objects so they can be
used in a UIComponent that expects it's values to contain objects of type
SelectItem.
|
static boolean |
isLocaleSupported(Locale locale)
Determines whether the supplied locale is one of the supported locales.
|
static javax.faces.model.SelectItem |
localeToSelectItem(Locale locale,
Locale displayLocale)
Converts the supplied locale to a SelectItem so that the supplied
locale is the value of the SelectItem and the display name of the
supplied locale is the label of the SelectItem.
|
public static Locale getCurrentLocale()
public static Locale getDefaultLocale()
public static boolean isLocaleSupported(Locale locale)
locale
- The locale to check.public static List<Locale> getSupportedLocales()
public static List<javax.faces.model.SelectItem> getSupportedLocalesAsListItems()
public static javax.faces.model.SelectItem localeToSelectItem(Locale locale, Locale displayLocale)
locale
- The locale to convert.displayLocale
- The locale to display the supplied locale in.NullPointerException
- When the supplied locale is null.Copyright © 2008–2018. All rights reserved.