Package org.primefaces.util
Class LocaleUtils
- java.lang.Object
-
- org.primefaces.util.LocaleUtils
-
public class LocaleUtils extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringcalculateLanguage(Locale locale)Gets ISO 639-1 Language Code from Locale so 'pt_BR' becomes 'pt'.static StringgetCurrentLanguage()Gets ISO 639-1 Language Code from current Locale so 'pt_BR' becomes 'pt'.static LocalegetCurrentLocale()static 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 LocaletoLocale(String str)Implementation from Apache Commons Lang
-
-
-
Method Detail
-
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
public static String toJavascriptLocale(Locale locale)
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
public static Locale getCurrentLocale(javax.faces.context.FacesContext context)
-
getCurrentLocale
public static Locale getCurrentLocale()
-
getDecimalSeparator
public static String getDecimalSeparator(javax.faces.context.FacesContext context)
-
getThousandSeparator
public static String getThousandSeparator(javax.faces.context.FacesContext context)
-
getCurrentLanguage
public static String getCurrentLanguage()
Gets ISO 639-1 Language Code from current Locale so 'pt_BR' becomes 'pt'.- Returns:
- the ISO 639-1 Language Code
- See Also:
- HTML Language Code Reference
-
-