Return order of languages which should be checked for parameter language.
    First is always the parameter language, later are fallback languages.
    Override parameter has priority over FALLBACK_LANGUAGES.
967443
def resolution_order(lang, override=None):
    
    if not settings.ENABLE_FALLBACKS:
        return (lang,)
    if override is None:
        override = {}
    fallback_for_lang = override.get(lang, settings.FALLBACK_LANGUAGES.get(lang, ()))
    fallback_def = override.get('default', settings.FALLBACK_LANGUAGES['default'])
    order = (lang,) + fallback_for_lang + fallback_def
    return tuple(unique(order))
561516
def get_best_language(self, accept_lang):
        """"""
        LUM = settings.LANGUAGE_URL_MAP
        langs = dict(LUM.items() + settings.CANONICAL_LOCALES.items())
        # Add missing short locales to the list. This will automatically map
        # en to en-GB (not en-US), es to es-AR (not es-ES), etc. in alphabetical
        # order. To override this behavior, explicitly define a preferred locale
        # map with the CANONICAL_LOCALES setting.
        langs.update((k.split('-')[0], v) for k, v in LUM.items() if
                     k.split('-')[0] not in langs)
        try:
            ranked = parse_accept_lang_header(accept_lang)
        except ValueError:  # see https://code.djangoproject.com/ticket/21078
            return
        else:
            for lang, _ in ranked:
                lang = lang.lower()
                if lang in langs:
                    return langs[lang]
                pre = lang.split('-')[0]
                if pre in langs:
                    return langs[pre]
737218
private function getLanguages($forcedLanguage = null, $fallbackLanguage = null)
    {
        if ($forcedLanguage !== null) {
            $languages = array($forcedLanguage);
        } else {
            $languages = $this->configResolver->getParameter('languages');
        }

        // Always add $fallbackLanguage, even if null, as last entry so that we can fallback to
        // main/initial language if domain supports it.
        $languages[] = $fallbackLanguage;

        return $languages;
    }
642549
public String getParamElementlanguage() {

        if (m_paramElementlanguage == null) {
            if ((m_editorSessionInfo != null) && (m_editorSessionInfo.getElementLocale() != null)) {
                m_paramElementlanguage = m_editorSessionInfo.getElementLocale().toString();
            }
        }
        return m_paramElementlanguage;
    }
1039540
def language(l):
	'''  '''

	# Usage: @language('en') or function = language('en')(function)

	def decorator(f):
		''' Decorator used to prepend the language as an argument. '''

		@wraps(f)
		def wrapper(*args, **kwargs):
			return f(l, *args, **kwargs)
		return wrapper

	return decorator
1008661
public function getBestRenderLocales($ordered = self::ORDER_LANG) {
        $locales = [];
        $this->getServerLocales();

        foreach($this->getClientLocales() as $locale) {
            /** @var Locale $locale  */

            $loc = $this->serverLocales->getBestMatchingLocaleForLocale($locale);
            if($loc && !in_array($loc, $locales)) {
                $locales[]  = $loc;
            }
        }
        if(count($locales) == 0) {
            if($this->defaultLocale)
                $locales[] = $this->defaultLocale;
            else {
                $locales[] = $this->getServerLocales()[0] ?? NULL;
            }
        }

        if($ordered & self::ORDER_STRUCT) {
            $locs = [];
            foreach($locales as $loc) {
                /** @var Locale $loc */
                $lang = $loc->getLanguage();

                $locs[$lang][] = $loc;
            }

            if($ordered & self::ORDER_LANG) {
                foreach($locs as &$ll)
                    usort($ll, LocaleCollection::LANG_SORT_CALLBACK);
            } elseif($ordered & self::ORDER_REG) {
                foreach($locs as &$ll)
                    usort($ll, LocaleCollection::REG_SORT_CALLBACK);
            }

            return $locs;
        }

        return $locales;
    }
1212243
public function getPriority()
    {
        if (!isset($this->priority)) {
            $typeToPriority = array(static::CONTEXT_ERROR   => static::PRIORITY_MAX,
                                    static::CONTEXT_WARNING => static::PRIORITY_HIGH,
                                    static::CONTEXT_SUCCESS => static::PRIORITY_MIN,
                                    static::CONTEXT_INFO    => static::PRIORITY_LOW);

            if (array_key_exists($this->context, $typeToPriority)) {
                return $typeToPriority[$this->context];
            }

            return static::PRIORITY_LOW;
        }

        return $this->priority;
    }
938401
def check_args_order(func):
    '''
    '''
    argspec = inspect.getargspec(func)
    parsed_data = parse_numpydoc_variables_units(func)
    # compare the parsed arguments with those actually defined
    parsed_units = parsed_data['Parameters']['units']
    parsed_parameters = parsed_data['Parameters']['vars']
    if 'Other Parameters' in parsed_data:
        parsed_parameters += parsed_data['Other Parameters']['vars']
        parsed_units += parsed_data['Other Parameters']['units']
    
    if argspec.args != parsed_parameters: # pragma: no cover
        raise Exception('Function %s signature is not the same as the documentation'
                        ' signature = %s; documentation = %s' %(func.__name__, argspec.args, parsed_parameters))
413661
def supported_languages(self):
        
        if self.__supported_languages is None:
            res = self.wiki_request({"meta": "siteinfo", "siprop": "languages"})
            tmp = res["query"]["languages"]
            supported = {lang["code"]: lang["*"] for lang in tmp}
            self.__supported_languages = supported
        return self.__supported_languages
261295
def fallback_to_default(localization_key, localization)
      localization_key.localizations.where.not(default_value: nil). \
        where.not(id: localization.id).first&.default_value
    end
720772
def parse_accept_lang_header(lang_string):
    
    result = []
    pieces = accept_language_re.split(lang_string)
    if pieces[-1]:
        return []
    for i in range(0, len(pieces) - 1, 3):
        first, lang, priority = pieces[i : i + 3]
        if first:
            return []
        priority = priority and float(priority) or 1.0
        result.append((lang, priority))
    result.sort(lambda x, y: -cmp(x[1], y[1]))
    return result
1075913
function topPriorityLanguageLocale()
    {
        $languageLocale = false;

        $language = $this->topPriorityLanguage();
        if ( $language )
            $languageLocale = $language->attribute( 'locale' );

        return $languageLocale;
    }
292613
def _get_default_language(self):
        

        assert hasattr(self, 'available_languages'), \
            'No available languages have been generated.'
        assert len(self.available_languages) > 0, \
            'No available languages to select from.'

        if (
            settings.DEFAULT_LANGUAGE and
            settings.DEFAULT_LANGUAGE in self.available_languages
        ) or (
            'language_code' not in self.form.base_fields
        ):
            # Default language still available

            self.available_languages.remove(settings.DEFAULT_LANGUAGE)
            return settings.DEFAULT_LANGUAGE

        else:
            # Select the first item and return it
            return self.available_languages.pop(0)
8452
public function getFallbackLocales()
    {
        if ($this->translator instanceof Translator || method_exists($this->translator, 'getFallbackLocales')) {
            return $this->translator->getFallbackLocales();
        }

        return [];
    }
280884
function getDependenciesOfLanguage (lang)
{
	if (!components.languages[lang] || !components.languages[lang].require)
	{
		return [];
	}

	return ($u.type(components.languages[lang].require) === "array")
		? components.languages[lang].require
		: [components.languages[lang].require];
}
961335
def get_lang_class(lang):
    
    global LANGUAGES
    # Check if an entry point is exposed for the language code
    entry_point = get_entry_point("spacy_languages", lang)
    if entry_point is not None:
        LANGUAGES[lang] = entry_point
        return entry_point
    if lang not in LANGUAGES:
        try:
            module = importlib.import_module(".lang.%s" % lang, "spacy")
        except ImportError as err:
            raise ImportError(Errors.E048.format(lang=lang, err=err))
        LANGUAGES[lang] = getattr(module, module.__all__[0])
    return LANGUAGES[lang]
289497
public function setFallbackLanguage($language)
    {
        if ( $this->isSupported($language) ) {
            $this->fallbackLanguage = $language;
        }
        else {
            throw new RuntimeException('Variable must be one of the supported languages.');
        }

        return $this;
    }