Populate the ``languages`` key.
194671
def languages(self, key, value):
    """"""
    languages = self.get('languages', [])

    values = force_list(value.get('a'))
    for value in values:
        for language in RE_LANGUAGE.split(value):
            try:
                name = language.strip().capitalize()
                languages.append(pycountry.languages.get(name=name).alpha_2)
            except KeyError:
                pass

    return languages
652685
def iter_languages(self):
        """"""
        default_lang = self.babel.default_locale.language
        default_title = self.babel.default_locale.get_display_name(
            default_lang)

        yield (default_lang, default_title)

        for l, title in current_app.config.get('I18N_LANGUAGES', []):
            yield l, title
526160
function scan(language) {
            var i;
            for (i = 0; i < availableLanguages.length; i += 1) {
                if (language.toLowerCase() === availableLanguages[i].toLowerCase()) {
                    return availableLanguages[i];
                }
            }
        }
1059592
def prefetch_translations(instances, **kwargs):
    
    from .mixins import ModelMixin

    if not isinstance(instances, collections.Iterable):
        instances = [instances]

    populate_missing = kwargs.get("populate_missing", True)
    grouped_translations = utils.get_grouped_translations(instances, **kwargs)

    # In the case of no translations objects
    if not grouped_translations and populate_missing:
        for instance in instances:
            instance.populate_missing_translations()

    for instance in instances:
        if (
            issubclass(instance.__class__, ModelMixin)
            and instance.pk in grouped_translations
        ):
            for translation in grouped_translations[instance.pk]:
                instance._linguist.set_cache(instance=instance, translation=translation)
            if populate_missing:
                instance.populate_missing_translations()
966918
function _populateLanguageDropdown() {
        // Get all non-binary languages
        var languages = _.values(LanguageManager.getLanguages()).filter(function (language) {
            return !language.isBinary();
        });

        // sort dropdown alphabetically
        languages.sort(function (a, b) {
            return a.getName().toLowerCase().localeCompare(b.getName().toLowerCase());
        });

        languageSelect.items = languages;

        // Add option to top of menu for persisting the override
        languageSelect.items.unshift("---");
        languageSelect.items.unshift(LANGUAGE_SET_AS_DEFAULT);
    }
293879
private void processMapping() {
        for (Entry<String, Set<String>> desiredToMatchingLanguages : matcherData.matchingLanguages().keyValuesSet()) {
            String desired = desiredToMatchingLanguages.getKey();
            Set<String> supported = desiredToMatchingLanguages.getValue();
            for (R3<ULocale, ULocale, Double> localeToMaxAndWeight : localeToMaxLocaleAndWeight) {
                final ULocale key = localeToMaxAndWeight.get0();
                String lang = key.getLanguage();
                if (supported.contains(lang)) {
                    addFiltered(desired, localeToMaxAndWeight);
                }
            }
        }
        // now put in the values directly, since languages always map to themselves
        for (R3<ULocale, ULocale, Double> localeToMaxAndWeight : localeToMaxLocaleAndWeight) {
            final ULocale key = localeToMaxAndWeight.get0();
            String lang = key.getLanguage();
            addFiltered(lang, localeToMaxAndWeight);
        }
    }
65955
def _from_dict(cls, _dict):
        """"""
        args = {}
        if 'customizations' in _dict:
            args['customizations'] = [
                LanguageModel._from_dict(x)
                for x in (_dict.get('customizations'))
            ]
        else:
            raise ValueError(
                'Required property \'customizations\' not present in LanguageModels JSON'
            )
        return cls(**args)
994231
def create(self, **kwargs):
        
        with auto_populate(self._populate_mode):
            return super(MultilingualQuerySet, self).create(**kwargs)
143575
def languages_for_select
      ::I18nData.languages.map{|pair| pair.reverse}.sort{|x,y| x.first <=> y.first}
    end
435109
protected function populateLanguageIDs() {
        $this->_cache_language_ids=array();
        if($snippetLanguages=$this->snippetLanguagesIncluded()) {
            // And keep a record of parents we don't need to get
            // parents of themselves, as well as IDs to mark
            foreach($snippetLanguages as $langId) {
                $this->_cache_language_ids[$langId]=true;
            }
        }
    }
1011610
public void populateL10nStrings() {
    AllPropertiesMessageSource allPropertiesMessageSource = new AllPropertiesMessageSource();
    String[] namespaces =
        localizationMessageSources
            .stream()
            .map(PropertiesMessageSource::getNamespace)
            .toArray(String[]::new);
    allPropertiesMessageSource.addMolgenisNamespaces(namespaces);
    localizationPopulator.populateLocalizationStrings(allPropertiesMessageSource);
  }
974492
def choose_language(self, lang, request):
        """"""

        # Can be an empty string or None
        if not lang:
            lang = get_language_from_request(request)

        # Raise a 404 if the language is not in not in the list
        if lang not in [key for (key, value) in settings.PAGE_LANGUAGES]:
            raise Http404

        # We're going to serve CMS pages in language lang;
        # make django gettext use that language too
        if lang and translation.check_for_language(lang):
            translation.activate(lang)

        return lang
251181
def assign_defaults(options)
      # Normalizes languages keys from symbols to strings
      normalize_language_keys(options)

      # Build a complete list of the required languages
      enabled_languages = detect_languages(options)

      # Get all languages used in existing settings
      (LOCALISED_VERSION_VALUES + LOCALISED_APP_VALUES).each do |key|
        current = options[key]
        next unless current && current.kind_of?(Hash)
        current.each do |language, value|
          enabled_languages << language unless enabled_languages.include?(language)
        end
      end

      # Check folder list (an empty folder signifies a language is required)
      ignore_validation = options[:ignore_language_directory_validation]
      Loader.language_folders(options[:metadata_path], ignore_validation).each do |lang_folder|
        next unless File.directory?(lang_folder) # We don't want to read txt as they are non localised
        language = File.basename(lang_folder)
        enabled_languages << language unless enabled_languages.include?(language)
      end

      return unless enabled_languages.include?("default")
      UI.message("Detected languages: " + enabled_languages.to_s)

      (LOCALISED_VERSION_VALUES + LOCALISED_APP_VALUES).each do |key|
        current = options[key]
        next unless current && current.kind_of?(Hash)

        default = current["default"]
        next if default.nil?

        enabled_languages.each do |language|
          value = current[language]
          next unless value.nil?

          current[language] = default
        end
        current.delete("default")
      end
    end
586262
def all_keys
      I18n.backend.send(:translations).collect do |_check_locale, translations|
        collect_keys([], translations).sort
      end.flatten.uniq
    end
407806
def get_fallback_languages():
    """"""
    lang = translation.get_language()
    fallback_list = settings.FALLBACK_LANGUAGES.get(lang, None)
    if fallback_list:
        return fallback_list

    return settings.FALLBACK_LANGUAGES.get(lang[:2], [])
132438
def parse(lang_sample):
    """"""
    words = words_from_archive(lang_sample, include_dups=True)
    counts = zero_default_dict()
    for word in words:
        counts[word] += 1
    return set(words), counts
1013905
def install_language(language):
    """"""
    translator = get_translator(default_domain, default_directory,
        languages=[get_lang(language)], fallback=True)
    do_unicode = True
    translator.install(do_unicode)