Class LanguageRegistry


  • class LanguageRegistry
    extends Object
    Class that represents the BCP-47 language registry, with all subtags in lowercase. Generated from "http://www.iana.org/assignments/language-subtag-registry/language-subtag-registry". Private and deprecated tags/subtags are not included.
    • Method Detail

      • init

        static void init()
        Loads the class in the classloader in order to initialize static members. Call this before using the class in order to avoid a slight performance hit on first use.
      • isLanguageSubtag

        static boolean isLanguageSubtag​(String subtag)
        Determines if the language subtag exists.
        Parameters:
        subtag - the language subtag (in lowercase)
        Returns:
        true or false
      • isExtlangSubtag

        static boolean isExtlangSubtag​(String subtag)
        Determines if the extlang subtag exists.
        Parameters:
        subtag - the extlang subtag (in lowercase)
        Returns:
        true or false
      • getExtlangPrefix

        static String getExtlangPrefix​(String subtag)
        Gets the prefix tag (in lowercase) for the extlang.
        Parameters:
        subtag - the extlang subtag (in lowercase)
        Returns:
        the prefix tag (in lowercase)
      • isScriptSubtag

        static boolean isScriptSubtag​(String subtag)
        Determines if the script subtag exists.
        Parameters:
        subtag - the script subtag (in lowercase)
        Returns:
        true or false
      • isRegionSubtag

        static boolean isRegionSubtag​(String subtag)
        Determines if the region subtag exists.
        Parameters:
        subtag - the region subtag (in lowercase)
        Returns:
        true or false
      • isVariantSubtag

        static boolean isVariantSubtag​(String subtag)
        Determines if the variant subtag exists.
        Parameters:
        subtag - the variant subtag (in lowercase)
        Returns:
        true or false
      • getVariantPrefixes

        static List<String> getVariantPrefixes​(String subtag)
        Gets a list of prefix tags (in lowercase) for the variant.
        Parameters:
        subtag - the variant subtag (in lowercase)
        Returns:
        the list of prefix tags (in lowercase)
      • isGrandfatheredTag

        static boolean isGrandfatheredTag​(String tag)
        Determines if the grandfathered tag exists.
        Parameters:
        tag - the tag (in lowercase)
        Returns:
        true or false