Package com.day.cq.commons
Class LanguageUtil
- java.lang.Object
-
- com.day.cq.commons.LanguageUtil
-
public class LanguageUtil extends Object
LanguageUtil...
-
-
Field Summary
Fields Modifier and Type Field Description static Set<String>ISO_COUNTRIESSet of all valid country iso codes.static Set<String>ISO_LANGUAGESSet of all valid language iso codes.static StringPSEUDO_LANGUAGE
-
Constructor Summary
Constructors Constructor Description LanguageUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static LanguagegetLanguage(String code)Returns the language for the given language/country abbreviation.static StringgetLanguageRoot(String path)Returns the language root for the given path by only analyzing the path names starting at the root.static LocalegetLocale(String code)Returns the language locale for the given language/country abbreviation.
-
-
-
Field Detail
-
ISO_LANGUAGES
public static final Set<String> ISO_LANGUAGES
Set of all valid language iso codes.- See Also:
Locale.getISOLanguages()
-
ISO_COUNTRIES
public static final Set<String> ISO_COUNTRIES
Set of all valid country iso codes.- See Also:
Locale.getISOCountries()
-
PSEUDO_LANGUAGE
public static final String PSEUDO_LANGUAGE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getLocale
public static Locale getLocale(String code)
Returns the language locale for the given language/country abbreviation.- Parameters:
code- the language/country code. eg de_CH- Returns:
- the locale or null if not valid.
-
getLanguage
public static Language getLanguage(String code)
Returns the language for the given language/country abbreviation.- Parameters:
code- the language/country code. eg de_CH or de-CH- Returns:
- the locale or null if not valid.
- Since:
- 5.4
-
-