Package com.day.cq.commons
Class Language
- java.lang.Object
-
- com.day.cq.commons.Language
-
public class Language extends java.lang.Object
Implements a wrapper around a locale that supports different codes for country and language. This is mostly used as workaround for language trees that don't follow the same format for locales in java.util.Locale.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getCountryCode()
java.lang.String
getLanguageCode()
java.util.Locale
getLocale()
static java.util.Locale
getLocale(java.lang.String code)
Parses a language code such as "de", "de_CH", "de_DE_EURO" or "de-CH" and returns the properLocale
object.java.lang.String
toString()
-
-
-
Constructor Detail
-
Language
public Language(java.util.Locale locale)
-
Language
public Language(java.lang.String code)
-
Language
public Language(java.util.Locale locale, java.lang.String language, java.lang.String country)
-
Language
public Language(java.lang.String language, java.lang.String country)
-
-
Method Detail
-
getLocale
public java.util.Locale getLocale()
-
getLanguageCode
public java.lang.String getLanguageCode()
-
getCountryCode
public java.lang.String getCountryCode()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getLocale
public static java.util.Locale getLocale(java.lang.String code)
Parses a language code such as "de", "de_CH", "de_DE_EURO" or "de-CH" and returns the properLocale
object.- Parameters:
code
- language code- Returns:
- locale object
-
-