Package org.primefaces.util
Class LocaleUtils
java.lang.Object
org.primefaces.util.LocaleUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringcalculateLanguage(Locale locale) Gets ISO 639-1 Language Code from Locale so 'pt_BR' becomes 'pt'.static StringGets ISO 639-1 Language Code from current Locale so 'pt_BR' becomes 'pt'.static Localestatic LocalegetCurrentLocale(javax.faces.context.FacesContext context) static StringgetDecimalSeparator(javax.faces.context.FacesContext context) static StringgetThousandSeparator(javax.faces.context.FacesContext context) static LocaleresolveLocale(javax.faces.context.FacesContext context, Object locale, String clientId) static StringtoJavascriptLocale(Locale locale) Some JS libraries like FullCalendar used by Schedule require the locale for "pt_BR" to be "pt-br".static LocaleImplementation from Apache Commons Lang
-
Method Details
-
toLocale
Implementation from Apache Commons Lang -
resolveLocale
public static Locale resolveLocale(javax.faces.context.FacesContext context, Object locale, String clientId) Gets aLocaleinstance by the value of the component attribute "locale" which can be String orLocaleor null.If NULL is passed the view root default locale is used.
- Parameters:
context- theFacesContextlocale- given localeclientId- the component clientId- Returns:
- resolved Locale
-
toJavascriptLocale
Some JS libraries like FullCalendar used by Schedule require the locale for "pt_BR" to be "pt-br".- Parameters:
locale- the Locale to convert- Returns:
- the Javascript string locale
-
getCurrentLocale
-
getCurrentLocale
-
getDecimalSeparator
-
getThousandSeparator
-
getCurrentLanguage
Gets ISO 639-1 Language Code from current Locale so 'pt_BR' becomes 'pt'.- Returns:
- the ISO 639-1 Language Code
- See Also:
-
calculateLanguage
Gets ISO 639-1 Language Code from Locale so 'pt_BR' becomes 'pt'.- Parameters:
locale- the Locale to calculate the language for- Returns:
- the ISO 639-1 Language Code
-