Package org.primefaces.util
Class LocaleUtils
java.lang.Object
org.primefaces.util.LocaleUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
calculateLanguage
(Locale locale) Gets ISO 639-1 Language Code from Locale so 'pt_BR' becomes 'pt'.static String
Gets ISO 639-1 Language Code from current Locale so 'pt_BR' becomes 'pt'.static Locale
static Locale
getCurrentLocale
(javax.faces.context.FacesContext context) static String
getDecimalSeparator
(javax.faces.context.FacesContext context) static String
getThousandSeparator
(javax.faces.context.FacesContext context) static Locale
resolveLocale
(javax.faces.context.FacesContext context, Object locale, String clientId) static String
toJavascriptLocale
(Locale locale) Some JS libraries like FullCalendar used by Schedule require the locale for "pt_BR" to be "pt-br".static Locale
Implementation 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 aLocale
instance by the value of the component attribute "locale" which can be String orLocale
or null.If NULL is passed the view root default locale is used.
- Parameters:
context
- theFacesContext
locale
- 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
-