Get the prefix of your pages with interpreted variables given as params.
 You normally don't want to call it yourself. Instead use the
 Humpyard::Page.human_url which will put the current ::I18n.locale into
 the params.
977261
def parsed_www_prefix(params)
      prefix = "#{www_prefix}"
      params.each do |key,value|
        prefix.gsub!(":#{key}", value.to_s)
      end
      prefix
    end
494930
def _make_request(self, params, translation_url, headers):
        
        resp = requests.get(translation_url, params=params, headers=headers)
        resp.encoding = "UTF-8-sig"
        result = resp.json()
        return result
95184
def initialize_with_i18n_routing(app, conditions, defaults, name)
      @locale = if conditions.key?(:i18n_locale)
        c = conditions.delete(:i18n_locale)
        # In rails 3.0 it's a regexp otherwise it's a string, so we need to call source on the regexp
        (c.respond_to?(:source) ? c.source : c).to_sym
      else
        nil
      end
      initialize_without_i18n_routing(app, conditions, defaults, name)
    end
1106017
@Route(method = HttpMethod.GET, uri = "i18n/bundles/{file<.+>}.json")
    public Result getBundleResourceForI18Next(@QueryParameter("locales") String listOfLocales,
                                              @HttpParameter(HeaderNames.IF_NONE_MATCH) String ifNoneMatch) {
        // Parse the list of locale
        List<Locale> locales = new ArrayList<>();
        if (!Strings.isNullOrEmpty(listOfLocales)) {
            String[] items = listOfLocales.split(" ");
            for (String item : items) {
                // Manage the 'dev' value (it's the default locale used by i18next
                if ("dev".equalsIgnoreCase(item)) {
                    locales.add(InternationalizationService.DEFAULT_LOCALE);
                } else {
                    locales.add(Locale.forLanguageTag(item));
                }
            }
        }

        String etag;
        StringBuilder builder = new StringBuilder();
        for (Locale locale : locales) {
            builder.append(service.etag(locale));
        }
        etag = builder.toString();

        if (ifNoneMatch != null && ifNoneMatch.equals(etag)) {
            return new Result(Status.NOT_MODIFIED);
        }

        // i18next use a specific Json Format
        ObjectNode result = json.newObject();
        for (Locale locale : locales) {
            ObjectNode lang = json.newObject();
            ObjectNode translation = json.newObject();
            lang.set("translation", translation);
            Collection<ResourceBundle> bundles = service.bundles(locale);
            for (ResourceBundle bundle : bundles) {
                for (String key : bundle.keySet()) {
                    populateJsonResourceBundle(translation, key, bundle.getString(key));
                }
            }
            String langName = locale.toLanguageTag();
            if (locale.equals(InternationalizationService.DEFAULT_LOCALE)) {
                langName = "dev";
            }
            result.set(langName, lang);
        }
        return ok(result).with(HeaderNames.ETAG, etag);
    }
1075515
def translate_uri(request)
			@@empty_check ||= Regexp.new('^/?$')
			@@lang_check ||= Regexp.new('^/[a-z]{2}(/|$)')
      uri = request.path
      request.uri ||= uri
      config = config(request)
      handle_shortcut(request, config)
      case uri
      when @@empty_check
        request.uri = config['redirect']['/'] ||= @handler_uri
      when @@lang_check
        begin
          self.parse_uri(request)
        rescue LoadError # this happens often
          res = simple_parse_uri(request)
        end
        request.uri = @handler_uri
      end
      Apache::DECLINED
		end
122692
private function getRouteParametersByInternalName($internalName, $locale, $parameters = array())
    {
        $url = '';
        $translation = $this->em->getRepository('KunstmaanNodeBundle:NodeTranslation')
            ->getNodeTranslationByLanguageAndInternalName($locale, $internalName);

        if (!is_null($translation)) {
            $url = $translation->getUrl();
        }

        return array_merge(
            array(
                'url' => $url,
                '_locale' => $locale,
            ),
            $parameters
        );
    }
482381
def page_redirect_url(options = {})
      options = {
        locale: prefix_locale? ? @page.language_code : nil,
        urlname: @page.urlname
      }.merge(options)

      alchemy.show_page_path additional_params.merge(options)
    end
1170868
public function resolve_language_url($currentPageID, $sectionID)
    {
        $resolve = ['/'];
        $lang = Section::getByID((int) $sectionID);
        if (is_object($lang)) {
            $resolve = [$lang];
            $page = \Page::getByID((int) $currentPageID);
            if (!$page->isError()) {
                $relatedID = $lang->getTranslatedPageID($page);
                if ($relatedID) {
                    $pc = \Page::getByID($relatedID);
                    $resolve = [$pc];
                } elseif ($page->isGeneratedCollection()) {
                    $this->app->make('session')->set('multilingual_default_locale', $lang->getLocale());
                    $resolve = [$page];
                }
            }
        }

        return $this->app->make(ResolverManagerInterface::class)->resolve($resolve);
    }
1328769
def initialize_with_i18n_routing(name, app, path, constraints, defaults = {})
      @locale = if constraints.key?(:i18n_locale)
        c = constraints.delete(:i18n_locale)
        # In rails 3.0 it's a regexp otherwise it's a string, so we need to call source on the regexp
        (c.respond_to?(:source) ? c.source : c).to_sym
      else
        nil
      end
      initialize_without_i18n_routing(name, app, path, constraints, defaults)
    end
1214886
def set_locale(request):
    """"""
    return request.query.get('lang', app.ps.babel.select_locale_by_request(request))
34966
def cache_key_prefix(request):
    
    cache_key = "%s.%s.%s." % (
        settings.CACHE_MIDDLEWARE_KEY_PREFIX,
        current_site_id(),
        device_from_request(request) or "default",
    )
    return _i18n_cache_key_suffix(request, cache_key)
1131335
public function localePrefix($url)
    {
        if (option('url_locale_prefix') &&
            str_starts_with($url, '/') &&
            !preg_match('/^\/' . $this->_localesPattern() . '/', $url)
        ) {
            $url = '/' . I18n::locale() . $url;
        }

        return $url;
    }
551033
def translate_with_context(key, options={})
      # default to an empty scope
      scope = []

      # Use the template for scoping if there is a templ
      unless self.template.nil?
        # The outer scope will typically be the controller name ("blog_posts")
        # but can also be a dir of shared partials ("shared").
        outer_scope = self.template.base_path
        
        # The template will be the view being rendered ("show.erb" or "_ad.erb")
        inner_scope = self.template.name
        
        # Partials template names start with underscore, which should be removed
        inner_scope.sub!(/^_/, '')

        scope = [outer_scope, inner_scope]
      end
      
      # In the case of a missing translation, fall back to letting TranslationHelper
      # put in span tag for a translation_missing.
      begin
        Translator.translate_with_scope(scope, key, options.merge({:raise => true}))
      rescue Translator::TranslatorError, I18n::MissingTranslationData => exc
        # Call the original translate method
        str = translate_without_context(key, options)
        
        # View helper adds the translation missing span like:
        # In strict mode, do not allow TranslationHelper to add "translation missing" span like:
        # <span class="translation_missing">en, missing_string</span>
        if str =~ /span class\=\"translation_missing\"/
          # In strict mode, do not allow TranslationHelper to add "translation missing"
          raise if Translator.strict_mode?
          
          # Invoke callback if it is defined
          Translator.missing_translation_callback(exc, key, options)
        end

        str
      end
    end
1220491
def get_user_locale(self):
        '''
        
        '''
        locale_id = self.get_cookie('ulocale')
        if locale_id:
            return tornado.locale.get(locale_id)
        else:
            return tornado.locale.get('en_US')
301115
private function get_user_locale() {
		global $wp_version;
		if ( version_compare( $wp_version, '4.7.0', '>=' ) ) {
			return get_user_locale();
		}
		$user = wp_get_current_user();
		if ( $user ) {
			$locale = $user->locale;
		}

		return $locale ? $locale : get_locale();
	}
80459
def get_public_cms_page_urls(*, language_code):
    
    pages = Page.objects.public()
    urls = [page.get_absolute_url(language=language_code) for page in pages]
    urls.sort()
    return tuple(urls)
32883
def get(args):
    

    html = args.H
    lang = args.l
    nowrap = args.n
    query = args.q
    silent = args.s
    title = args.t
    verbose = args.v
    wiki = args.w

    if query:
        qobj = WPToolsQuery(lang=lang, wiki=wiki)
        if title:
            return qobj.query(title)
        return qobj.random()

    page = wptools.page(title, lang=lang, silent=silent,
                        verbose=verbose, wiki=wiki)

    try:
        page.get_query()
    except (StandardError, ValueError, LookupError):
        return "NOT_FOUND"

    if not page.data.get('extext'):
        out = page.cache['query']['query']

    out = _page_text(page, nowrap)
    if html:
        out = _page_html(page)

    try:
        return out.encode('utf-8')
    except KeyError:
        return out