Gets the correct label attribute for the given language, or the default if not found

@param langCode language code
@return label attribute
979617
public Attribute getLabelAttribute(String langCode) {
    Attribute labelAttr = getLabelAttribute();
    Attribute i18nLabelAttr =
        labelAttr != null ? getAttribute(labelAttr.getName() + '-' + langCode) : null;
    return i18nLabelAttr != null ? i18nLabelAttr : labelAttr;
  }
811924
public function getGenericLabel( $searchRole, $searchLabel = null, $searchLang = null, $linkPath = null )
	{
		if ( ! isset( $this->genericRoles['roles'] ) ) return false;

		$results = array();

		if ( ! isset( $this->genericRoles['roles'][ $searchRole ]['labels'] ) ) return $results;

		foreach ( $this->genericRoles['roles'][ $searchRole ]['labels'] as $linkbase => $labels )
		{
			foreach ( $labels as $label => $langs )
			{
				if ( ! is_null( $searchLabel ) && $label != $searchLabel ) continue;

				foreach ( $langs['lang'] as $lang => $text )
				{
					if ( ! is_null( $searchLang ) && $lang != $searchLang ) continue;

					$results[ $label ] = array(
						'linkbase' => $linkbase,
						'label' => $label,
						'lang' => $lang,
						'text' => isset( $text[ $linkPath ] ) ? $text[ $linkPath] : reset( $text ),
					);
				}

				if ( ! is_null( $searchLabel ) )
				{
					return $results;
				}
			}
		}

		return $results;
	}
157350
public function getNativeName($languageCode = null): ?string
    {
        $languageCode = $languageCode ? mb_strtolower($languageCode) : null;

        return $this->get("name.native.{$languageCode}.common")
            ?: (current($this->get('name.native', []))['common'] ?: $this->get('native_name'));
    }
874384
public static Label.Builder generateLabelBuilder(final Locale locale, final String label) {
        return addLabel(Label.newBuilder(), locale.getLanguage(), label);
    }
399326
def _get_language_description(self, language_code):
        

        language = language_code.lower()
        parameter = 'language-' + language
        if self.configure.has_parameter(parameter):
            return self.configure.get_parameter(parameter)
        elif '-' in language:
            codes = re.split(r'\-', language)
            parameter = 'language-' + codes[0]
            if self.configure.has_parameter(parameter):
                return self.configure.get_parameter(parameter)
        return None
394897
protected function install_language_pack($langcode) {

        // initialise new component installer to process this language
        $installer = new component_installer('https://download.moodle.org', 'download.php/direct/langpack/' . $this->version,
            $langcode . '.zip', 'languages.md5', 'lang');

        if (!$installer->requisitesok) {
            throw new lang_installer_exception('installer_requisites_check_failed');
        }

        $status = $installer->install();

        if ($status == COMPONENT_ERROR) {
            if ($installer->get_error() === 'remotedownloaderror') {
                return self::RESULT_DOWNLOADERROR;
            } else {
                throw new lang_installer_exception($installer->get_error(), $langcode);
            }

        } else if ($status == COMPONENT_UPTODATE) {
            return self::RESULT_UPTODATE;

        } else if ($status == COMPONENT_INSTALLED) {
            return self::RESULT_INSTALLED;

        } else {
            throw new lang_installer_exception('unexpected_installer_result', $status);
        }
    }
1318969
public function getDefaultName($code)
    {
        if (!array_key_exists($code, $this->defaultNameMapping)) {
            throw new LanguageNotFoundException(sprintf('Default language name for code "%s" not found.', $code));
        }

        return $this->defaultNameMapping[$code];
    }
682846
public String getLabel(HasOther e) {

	List<LangString> labels = ((HasLabel) e).getLabel();
	if ((labels == null) || (labels.isEmpty()))
	    return null;
	if (e instanceof HasLabel)
	    return labels.get(0).getValue();
	return "pFact: label TODO";
    }
1151307
public static String getLabel(Language lang, String section, String idInSection) {
		if (idInSection==null || "".equals(idInSection)){
			log.warn("Empty label for section:"+section+" and lang:"+lang);
			return "";
		} else if (lang.isDebug()){
			return lang.getLanguageId()+"|"+idInSection+"|"+section;
		} else {
			return connector.i18nLabel(lang, section, idInSection);
		}
	}
78144
public Style getStyleForScanValue( int code )
  {
    Style s = _tokenStyles.get( new Integer( code ) );
    if( s == null )
    {
      s = getStyle( DEFAULT_STYLE );
    }
    return s;
  }
781077
def get_title(self, language_code, lang_name):
        
        title = "%s %i-%i in %s" % (self.title_prefix, self.current_count,
                                    self.current_level, language_code)
        log.info(title)
        return title
1125565
public function getLabel($lang = null)
    {
        $lang = empty($lang) ? $this->getDefaultLanguage() : $lang;

        if (!isset($this->labels[$lang])) {
            return $this->getFirstLabel();
        }

        return $this->labels[$lang];
    }
719941
public static function getMessage( $code, $lang = 'EN' ) {
    if( $code < 0 ) {
      return null;
    } //code invalid

    $lang = strtoupper( $lang );

    if( !array_key_exists( $lang, self::$code ) ) { //language not found
      $lang = 'EN';
    }

    if( array_key_exists( $code, self::$code[$lang] ) ) { //code not defined
      return self::$code[$lang][$code];
    }

    return null;
  }
727588
public Locale getLocaleOrDefault(String language) {
        String lang = getLanguageOrDefault(language);
        return Locale.forLanguageTag(lang);
    }
178355
public static String getBetterToken( int tokenType, String defaultValue, LanguageLevelOption languageLevel ) {
        switch (languageLevel) {
            case DRL5:
                return getBetterTokenForDRL5(tokenType, defaultValue);
            case DRL6:
            case DRL6_STRICT:
                return getBetterTokenForDRL6(tokenType, defaultValue);
        }
        throw new RuntimeException("Unknown language level");
    }
314989
def get_label(self, code):
        

        for style in self.styles:
            if style[1] == code:
                return style[0]

        msg = _("Code {code} is invalid.").format(code=code)
        raise ValueError(msg)
325057
def label(lang=nil)
      label = @doc.elements['/manifest/application'].attributes['label']
      if label.nil?
        # application element has no label attributes.
        # so looking for activites that has label attribute.
        activities = @doc.elements['/manifest/application'].find{|e| e.name == 'activity' && !e.attributes['label'].nil? }
        label = activities.nil? ? nil : activities.first.attributes['label']
      end
      unless @rsc.nil?
        if /^@(\w+\/\w+)|(0x[0-9a-fA-F]{8})$/ =~ label
          opts = {}
          opts[:lang] = lang unless lang.nil?
          label = @rsc.find(label, opts)
        end
      end
      label
    end