Class 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.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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()
    • Constructor Detail

      • LanguageUtil

        public LanguageUtil()
    • 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