Class WbLanguageConstant

    • Field Detail

      • _langId

        protected String _langId
      • _origLangId

        protected String _origLangId
      • _langLabel

        protected String _langLabel
    • Constructor Detail

      • WbLanguageConstant

        public WbLanguageConstant​(String langId,
                                  String langLabel)
    • Method Detail

      • validate

        public void validate​(ValidationState validation)
        Description copied from interface: WbExpression
        Check that this expression is fully formed and ready to be evaluated.
        Specified by:
        validate in interface WbExpression<String>
        Parameters:
        validation - the state in which to log any validation errors
      • normalizeLanguageCode

        public static String normalizeLanguageCode​(String lang)
      • normalizeLanguageCode

        public static String normalizeLanguageCode​(String lang,
                                                   String mediaWikiApiEndpoint)
        Checks that a language code is valid and returns its preferred version (converting deprecated language codes to their better values).
        Parameters:
        lang - a Wikimedia language code
        mediaWikiApiEndpoint - the MediaWiki API endpoint of the Wikibase
        Returns:
        the normalized code, or null if the code is invalid.
      • getLang

        public String getLang()
        Returns:
        the language code for this language
      • getLabel

        public String getLabel()
        Returns:
        the name of the language in itself
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object