Package com.day.cq.commons
Class LanguageUtil
java.lang.Object
com.day.cq.commons.LanguageUtil
LanguageUtil...-
Field Summary
FieldsModifier and TypeFieldDescriptionSet of all valid country iso codes.Set of all valid language iso codes.static final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic 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 LocaleReturns the language locale for the given language/country abbreviation.
-
Field Details
-
ISO_LANGUAGES
Set of all valid language iso codes.- See Also:
-
ISO_COUNTRIES
Set of all valid country iso codes.- See Also:
-
PSEUDO_LANGUAGE
- See Also:
-
-
Constructor Details
-
LanguageUtil
public LanguageUtil()
-
-
Method Details
-
getLocale
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
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
-
getLanguageRoot
Returns the language root for the given path by only analyzing the path names starting at the root.- Parameters:
path- path- Returns:
- the language root or
nullif not found
-