Get the preferred subtag.

        :return: preferred :class:`language_tags.Subtag.Subtag` if exists, otherwise None.
549259
def preferred(self):
        
        if 'Preferred-Value' in self.data['record']:
            preferred = self.data['record']['Preferred-Value']
            type = self.data['type']
            if type == 'extlang':
                type = 'language'
            return Subtag(preferred, type)
        return None
230556
def get_actual_tag
      supported_tags = @bbtree.current_node[:definition][:supported_tags]

      supported_tags.each do |tag|
        regex_list = @dictionary[tag][:url_matches]

        regex_list.each do |regex|
          return tag if regex =~ @ti.text
        end
      end
      :tag_not_found
    end
437059
def tml_language_flag_tag(lang = tml_current_language, opts = {})
      return '' unless tml_application.feature_enabled?(:language_flags)
      html = image_tag(lang.flag_url, :style => (opts[:style] || 'vertical-align:middle;'), :title => lang.native_name)
      html << '&nbsp;&nbsp;'.html_safe
      html.html_safe
    end
1334200
def get_preferred_encodings(self):
        
        encodings = []
        for row in range(self.ui.tableWidgetPreferred.rowCount()):
            item = self.ui.tableWidgetPreferred.item(row, 0)
            encodings.append(item.data(QtCore.Qt.UserRole))
        return encodings
245644
def get_language(self):
        
        if 'lang' in self.request.GET:
            lang = self.request.GET['lang'].lower()
            if lang in settings.LANGUAGE_URL_MAP:
                return settings.LANGUAGE_URL_MAP[lang]

        if self.request.META.get('HTTP_ACCEPT_LANGUAGE'):
            best = self.get_best_language(
                self.request.META['HTTP_ACCEPT_LANGUAGE'])
            if best:
                return best
        return settings.LANGUAGE_CODE
1315968
def get_language(self):
        
        locale = self.get_locale()
        language = locale
        if '_' in locale:
            language = locale[0:locale.index('_')]
        return language
783389
public function languageTag()
    {
        $language_tag = $this->language()->code();
        if ($this->script() != $this->language()->defaultScript()) {
            $language_tag .= '-' . $this->script()->code();
        }
        if ($this->territory() != $this->language()->defaultTerritory()) {
            $language_tag .= '-' . $this->territory()->code();
        }
        if ($this->variant()) {
            $language_tag .= '-' . $this->variant()->code();
        }

        return $language_tag;
    }
1141090
def find_by_tag(self, tag) -> Dict[str, Set[Parameter]]:
        
        return self.tags[tag]
522139
def _searchable_form(self) -> 'Language':
        
        if self._searchable is not None:
            return self._searchable

        self._searchable = self._filter_attributes(
            {'language', 'script', 'region'}
        ).simplify_script().prefer_macrolanguage()
        return self._searchable
462711
def input(self, request, tag):
        
        subform = self.parameter.form.asSubForm(self.parameter.name)
        subform.setFragmentParent(self)
        return tag[subform]
496339
def get_parent_active_language_choices(parent_object, exclude_current=False):
    
    assert parent_object is not None, "Missing parent_object!"

    from .db import ContentItem
    qs = ContentItem.objects \
        .parent(parent_object, limit_parent_language=False) \
        .values_list('language_code', flat=True).distinct()

    languages = set(qs)

    if exclude_current:
        parent_lang = get_parent_language_code(parent_object)
        languages.discard(parent_lang)

    if parler_appsettings.PARLER_LANGUAGES and not parler_appsettings.PARLER_SHOW_EXCLUDED_LANGUAGE_TABS:
        site_id = get_parent_site_id(parent_object)
        try:
            lang_dict = parler_appsettings.PARLER_LANGUAGES[site_id]
        except KeyError:
            lang_dict = ()

        allowed_languages = set(item['code'] for item in lang_dict)
        languages &= allowed_languages

    # No multithreading issue here, object is instantiated for this user only.
    choices = [(lang, str(get_language_title(lang))) for lang in languages if lang]
    choices.sort(key=lambda tup: tup[1])
    return choices
1346645
public PreferTag getReturn() {
        return preferTags().stream()
                .filter(x -> x.getTag().equals("return"))
                .findFirst().orElse(emptyTag());
    }
689362
def filter(subtags):
        
        if not isinstance(subtags, list):
            subtags = [subtags]
        return [subtag for subtag in subtags if len(tags.types(subtag)) == 0]
951843
def _get_tag(self, name):
        """"""
        if name.endswith("_"):
            if name[:-1] in self._schema.reserved:
                return name[:-1]
        return name
589104
def default(self, request, tag):
        
        if self.parameter.default is not None:
            tag[self.parameter.default]
        return tag
947769
def tml_language_selector_tag(type = nil, opts = {})
      return unless Tml.config.enabled?

      type ||= :default
      type = :dropdown if type == :select

      opts = opts.collect{|key, value| "data-tml-#{key}='#{value}'"}.join(' ')
      "<div data-tml-language-selector='#{type}' #{opts}></div>".html_safe
    end
473428
def get_tag(tag_type)
      matches = @tags.select { |m| m.type==tag_type }
      return matches.first
    end