Return the URL's path component. Add the language prefix if
        ``PAGE_USE_LANGUAGE_PREFIX`` setting is set to ``True``.

        :param language: the wanted url language.
169605
def get_url_path(self, language=None):
        
        if self.is_first_root():
            # this is used to allow users to change URL of the root
            # page. The language prefix is not usable here.
            try:
                return reverse('pages-root')
            except Exception:
                pass
        url = self.get_complete_slug(language)
        if not language:
            language = settings.PAGE_DEFAULT_LANGUAGE
        if settings.PAGE_USE_LANGUAGE_PREFIX:
            return reverse('pages-details-by-path',
                args=[language, url])
        else:
            return reverse('pages-details-by-path', args=[url])
1332982
def define_localized_url_helper(route, name, kind, options)
      if n = localizable
        selector = url_helper_name(name, kind)

        rlang = if n.kind_of?(ActionDispatch::Routing::Mapper::Resources::Resource) and i = name.to_s.rindex("_#{n.plural}")
                  "#{selector.to_s[0, i]}_glang_#{n.plural}#{selector.to_s[i + "_#{n.plural}".size, selector.to_s.size]}"
                elsif n.kind_of?(ActionDispatch::Routing::Mapper::Resources::Resource) and i = name.to_s.rindex("_#{n.singular}")
                  "#{selector.to_s[0, i]}_glang_#{n.singular}#{selector.to_s[i + "_#{n.singular}".size, selector.to_s.size]}"
                else
                  "glang_#{selector}"
                end

        @module.module_eval <<-end_eval # We use module_eval to avoid leaks
          alias_method :localized_#{selector}, :#{selector}

          def #{selector}(*args)
            selector_g = '#{rlang}'.gsub('glang', I18nRouting.locale_escaped(I18n.locale.to_s)).to_sym

            #puts "Call routes : #{selector} => \#{selector_g} (\#{I18n.locale}) "
            if respond_to? selector_g and selector_g != :#{selector}
              send(selector_g, *args)
            else
              localized_#{selector}(*args)
            end
          end

        end_eval

      end
    end
97564
def redirect_to_lang(*args, **kwargs):
    ''''''
    endpoint = request.endpoint.replace('_redirect', '')
    kwargs = multi_to_dict(request.args)
    kwargs.update(request.view_args)
    kwargs['lang_code'] = default_lang
    return redirect(url_for(endpoint, **kwargs))
577822
public function getLanguagePath($basePath = ANPATH_BASE, $language = null )
	{
		$dir = $basePath.DS.'language';

        if (!empty($language)) {
			$dir .= DS.$language;
		}

		return $dir;
	}
1118950
def prefix_locale?(locale = Language.current.code)
      multi_language? && locale != ::I18n.default_locale.to_s
    end
588603
def get_language(language_name):
    

    langs = list(pkg_resources.iter_entry_points(group=LANG_EP,
                                                 name=language_name))

    if not langs:
        raise TextXError('Language "{}" is not registered.'
                         .format(language_name))

    if len(langs) > 1:
        # Multiple languages defined with the same name
        raise TextXError('Language "{}" registered multiple times:\n{}'
                         .format(language_name,
                                 "\n".join([l.dist for l in langs])))

    return langs[0].load()()
1275686
def path_to_slug(path):
    
    from yacms.urls import PAGES_SLUG
    lang_code = translation.get_language_from_path(path)
    for prefix in (lang_code, settings.SITE_PREFIX, PAGES_SLUG):
        if prefix:
            path = path.replace(prefix, "", 1)
    return clean_slashes(path) or "/"
270562
def get_language_parameter(request, query_language_key='language', object=None, default=None):
    
    # This is the same logic as the django-admin uses.
    # The only difference is the origin of the request parameter.
    if not is_multilingual_project():
        # By default, the objects are stored in a single static language.
        # This makes the transition to multilingual easier as well.
        # The default language can operate as fallback language too.
        return default or appsettings.PARLER_LANGUAGES.get_default_language()
    else:
        # In multilingual mode, take the provided language of the request.
        code = request.GET.get(query_language_key)

        if not code:
            # forms: show first tab by default
            code = default or appsettings.PARLER_LANGUAGES.get_first_language()

        return normalize_language_code(code)
771203
def _setup_language_variables(self, lang: str):  # pylint: disable=no-self-use
        
        assert lang in TAGGERS.keys(), \
            'POS tagger not available for {0} language.'.format(lang)
        rel_path = os.path.join('~/cltk_data',
                                lang,
                                'model/' + lang + '_models_cltk/taggers/pos')  # pylint: disable=C0301
        path = os.path.expanduser(rel_path)
        tagger_paths = {}
        for tagger_key, tagger_val in TAGGERS[lang].items():
            tagger_path = os.path.join(path, tagger_val)
            assert os.path.isfile(tagger_path), \
                'CLTK linguistics models not available for {0}, looking for .'.format([tagger_val, tagger_path])
            tagger_paths[tagger_key] = tagger_path
        return tagger_paths
476357
def get_language():
    
    lang = _get_language()
    if lang is None:  # Django >= 1.8
        return settings.DEFAULT_LANGUAGE
    if lang not in settings.AVAILABLE_LANGUAGES and '-' in lang:
        lang = lang.split('-')[0]
    if lang in settings.AVAILABLE_LANGUAGES:
        return lang
    return settings.DEFAULT_LANGUAGE
1261962
public function prependLanguage($path, $language = null)
    {
        $prepend = ( isset($language) ? $language : $this->getLanguage() );

        if ( strlen($prepend) > 1 ) {
            return $prepend . (strpos($path, '/') === 0 ? $path : '/' . $path);
        }

        return $path;
    }
914821
private function _GetLangPath()
	{
		$lang_path = "";
		$paths = explode(PATH_SEPARATOR,get_include_path());

		foreach ($paths as $path)
		{
			if (file_exists($path . '/language/phpmailer.lang-en.php'))
			{
				$lang_path = $path . '/language/';
			}
		}
		return $lang_path;
	}
1269468
def get_language_settings(language_code, site_id=None):
    
    if site_id is None:
        site_id = getattr(settings, 'SITE_ID', None)

    for lang_dict in FLUENT_BLOGS_LANGUAGES.get(site_id, ()):
        if lang_dict['code'] == language_code:
            return lang_dict

    return FLUENT_BLOGS_LANGUAGES['default']
357782
def get_language_from_request(request):
    """"""
    language = request.GET.get('language', None)
    if language:
        return language

    if hasattr(request, 'LANGUAGE_CODE'):
        lang = settings.PAGE_LANGUAGE_MAPPING(str(request.LANGUAGE_CODE))
        if lang not in LANGUAGE_KEYS:
            return settings.PAGE_DEFAULT_LANGUAGE
        else:
            return lang
    else:
        return settings.PAGE_DEFAULT_LANGUAGE
945227
public String getLanguageComponent(String language) {
        if (StringUtils.isNullOrEmpty(language)) {
            return "";
        }

        if (language.contains("-")) {
            return language.split("-")[0];
        } else if (language.contains("_")) {
            return language.split("_")[0];
        }

        return language;
    }
654111
private static String getLanguageSuffix(String language) {

        if (language.equals(Locale.JAPANESE.getLanguage())) {
            return "jp";
        } else {
            return language;
        }
    }
1356403
public String getLanguageOrDefault(RouteContext routeContext) {
        final String cookieName = generateLanguageCookie(defaultLanguage).getName();

        // Step 1: Look for a Response cookie.
        // The Response always has priority over the Request because it may have
        // been set earlier in the HandlerChain.
        Cookie cookie = routeContext.getResponse().getCookie(cookieName);
        if (cookie != null && !StringUtils.isNullOrEmpty(cookie.getValue())) {
            return getLanguageOrDefault(cookie.getValue());
        }

        // Step 2: Look for a Request cookie.
        cookie = routeContext.getRequest().getCookie(cookieName);
        if (cookie != null && !StringUtils.isNullOrEmpty(cookie.getValue())) {
            return getLanguageOrDefault(cookie.getValue());
        }

        // Step 3: Look for a lang parameter in the response locals
        if (routeContext.getResponse().getLocals().containsKey(PippoConstants.REQUEST_PARAMETER_LANG)) {
            String language = routeContext.getLocal(PippoConstants.REQUEST_PARAMETER_LANG);
            language = getLanguageOrDefault(language);
            return language;
        }

        // Step 4: Look for a language in the Accept-Language header.
        String acceptLanguage = routeContext.getHeader(HttpConstants.Header.ACCEPT_LANGUAGE);
        return getLanguageOrDefault(acceptLanguage);
    }