Package com.day.cq.commons
Class LanguageUtil
- java.lang.Object
-
- com.day.cq.commons.LanguageUtil
-
public class LanguageUtil extends java.lang.Object
LanguageUtil
...
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.Set<java.lang.String>
ISO_COUNTRIES
Set of all valid country iso codes.static java.util.Set<java.lang.String>
ISO_LANGUAGES
Set of all valid language iso codes.static java.lang.String
PSEUDO_LANGUAGE
-
Constructor Summary
Constructors Constructor Description LanguageUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Language
getLanguage(java.lang.String code)
Returns the language for the given language/country abbreviation.static java.lang.String
getLanguageRoot(java.lang.String path)
Returns the language root for the given path by only analyzing the path names starting at the root.static java.util.Locale
getLocale(java.lang.String code)
Returns the language locale for the given language/country abbreviation.
-
-
-
Field Detail
-
ISO_LANGUAGES
public static final java.util.Set<java.lang.String> ISO_LANGUAGES
Set of all valid language iso codes.- See Also:
Locale.getISOLanguages()
-
ISO_COUNTRIES
public static final java.util.Set<java.lang.String> ISO_COUNTRIES
Set of all valid country iso codes.- See Also:
Locale.getISOCountries()
-
PSEUDO_LANGUAGE
public static final java.lang.String PSEUDO_LANGUAGE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getLocale
public static java.util.Locale getLocale(java.lang.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(java.lang.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
-
getLanguageRoot
public static java.lang.String getLanguageRoot(java.lang.String path)
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
null
if not found
-
-