Simple helper that will fire django signal in order to get User language possibly given by other part of application.
    :param user:
    :return: string or None
326744
def get_user_language(user):
    
    return_value = {}
    user_language.send(sender=user, user=user, return_value=return_value)
    return return_value.get('language')
385890
def get_language(query: str) -> str:
    
    query = query.lower()
    for language in LANGUAGES:
        if query.endswith(language):
            return language
    return ''
1297294
def get_available_languages(self, obj):
        
        if obj:
            return obj.get_available_languages()
        else:
            return self.model._parler_meta.root_model.objects.none()
64037
def getlanguage(self, language=None, windowsversion=None):
        
        if not language:
            language = self.language
        if language in (None, "", "*", "neutral"):
            return (LANGUAGE_NEUTRAL_NT5,
                    LANGUAGE_NEUTRAL_NT6)[(windowsversion or 
                                           sys.getwindowsversion()) >= (6, )]
        return language
578405
def _setup_language_variables(self):
        
        if self.language not in AVAILABLE_LANGUAGES:
            # If no official repos, check if user has custom
            user_defined_corpora = self._check_distributed_corpora_file()
            if user_defined_corpora:
                return user_defined_corpora
            else:
                msg = 'Corpora not available (either core or user-defined) for the "{}" language.'.format(self.language)
                logger.info(msg)
                raise CorpusImportError(msg)
        else:
            user_defined_corpora = self._check_distributed_corpora_file()
            return user_defined_corpora
361549
def _get_user_agent_string(self):
        """"""
        uname = platform.uname()
        try:
            lang = locale.getlocale()[0][:2]
        except:
            lang = ''
        py_version = '{0}.{1}.{2}'.format(*sys.version_info)
        return 'internetarchive/{0} ({1} {2}; N; {3}; {4}) Python/{5}'.format(
            __version__, uname[0], uname[-1], lang, self.access_key, py_version)
214248
def get_available_languages(self, obj):
        
        return obj.available_languages if obj is not None else self.model.objects.none()
257269
def ref_lang(self):
        
        ref_lang = self._request_request('ref_lang', 'msgid')
        if ref_lang != 'msgid':
            allowed_languages = {l[0] for l in rosetta_settings.ROSETTA_LANGUAGES}
            if ref_lang not in allowed_languages:
                raise Http404
        return ref_lang
1354591
def get_language_details(self, language):
        """"""
        for lang in self.user_data.languages:
            if language == lang['language_string']:
                return lang

        return {}
1191719
function doUserLanguage(Userinfo $userinfo, Userinfo &$existinguser)
	{
		$changed = false;
		//Update the user language with the current used in Joomla or the one existing from an other plugin
		if (empty($userinfo->language)) {
			$user_lang = '';
			if (!empty($userinfo->params)) {
				$params = new Registry($userinfo->params);
				$user_lang = $params->get('language');
			}
			$userinfo->language = !empty($user_lang) ? $user_lang : Factory::getLanguage()->getTag();
		}
		if (!empty($userinfo->language) && isset($existinguser->language) && !empty($existinguser->language) && $userinfo->language != $existinguser->language) {
			try {
				$this->updateUserLanguage($userinfo, $existinguser);
				$existinguser->language = $userinfo->language;
				$this->debugger->addDebug(Text::_('LANGUAGE_UPDATED') . ' : ' . $existinguser->language . ' -> ' . $userinfo->language);

				$changed = true;
			} catch (Exception $e) {
				$this->debugger->addError(Text::_('LANGUAGE_UPDATED_ERROR') . ' ' . $e->getMessage());
			}
		} else {
			//return a debug to inform we skipped this step
			$this->debugger->addDebug(Text::_('LANGUAGE_NOT_UPDATED'));
		}
		return $changed;
	}
321729
def translate_url(context, language):
    
    try:
        request = context["request"]
    except KeyError:
        return ""
    view = resolve(request.path)
    current_language = translation.get_language()
    translation.activate(language)
    try:
        url = reverse(view.func, args=view.args, kwargs=view.kwargs)
    except NoReverseMatch:
        try:
            url_name = (view.url_name if not view.namespace
                        else '%s:%s' % (view.namespace, view.url_name))
            url = reverse(url_name, args=view.args, kwargs=view.kwargs)
        except NoReverseMatch:
            url_name = "admin:" + view.url_name
            url = reverse(url_name, args=view.args, kwargs=view.kwargs)
    translation.activate(current_language)
    if context['request'].META["QUERY_STRING"]:
        url += "?" + context['request'].META["QUERY_STRING"]
    return url
700240
def _get_user_info(user=None):
    '''
    
    '''
    if not user:
        # Get user Salt runnining as
        user = __salt__['config.option']('user')

    userinfo = __salt__['user.info'](user)

    if not userinfo:
        if user == 'salt':
            # Special case with `salt` user:
            # if it doesn't exist then fall back to user Salt running as
            userinfo = _get_user_info()
        else:
            raise SaltInvocationError('User {0} does not exist'.format(user))

    return userinfo
1315968
def get_language(self):
        
        locale = self.get_locale()
        language = locale
        if '_' in locale:
            language = locale[0:locale.index('_')]
        return language
1167116
def get_name(self, language):
        
        return self.gettext(language, self._name) if self._name else ""
551465
def get_user(self, userPk):
        """"""
        r = self._request('user/' + str(userPk))
        if r:
            # Set base properties and copy data inside the user
            u = User()
            u.pk = u.id = userPk
            u.__dict__.update(r.json())
            return u
        return None
1198837
def LookupWithType(self, user_str):
        
        prefix = 'template '
        ref = None  # fail the lookup by default
        if user_str.startswith(prefix):
            name = user_str[len(prefix):]
            if name == 'SELF':
                # we can resolve this right away
                ref = _TemplateRef(template=self.owner)  # special value
            else:
                ref = _TemplateRef(name)
        
        return ref, (), TEMPLATE_FORMATTER
564030
def get_org_langs(username)
      org_repos = get_org_repos(username)
      langs = {}
      org_repos[:public].each do |r|
        next if org_repos[:forks].include? r
        repo_langs = @octokit.languages(r)
        repo_langs.each do |l, b|
          if langs[l].nil?
            langs[l] = b
          else
            langs[l] += b
          end
        end
      end
      langs
    end