Gets the back route with the correct language
@param  string $language Language to be replaced
@return string           string for back url
12984
public function getLocalBack($language)
    {
        $backUrl = redirect()->back()->getTargetUrl();
        $current = $this->getCurrentLanguage();
        $start = strpos($backUrl, $current);
        $count = strlen($current);
        if ($backUrl[$start - 1] == '/' && (!isset($backUrl[$start + $count])) || $backUrl[$start + $count] == '/') {
            $backUrl = substr_replace($backUrl, $language, $start, $count);
        }
        return $backUrl;
    }
303801
protected function getRequestedPath(Request $request, Language $language)
    {
        $segments = $request->segments();
        if (!$language->isDefault()) {
            array_shift($segments);
        }
        return implode('/', $segments);
    }
954777
public function get_translation(\Skeleton\I18n\Language $language) {
		$classname = $this->classname;
		$class = $classname::get_by_id($this->object_id);
		$label = 'text_' . $language->name_short . '_' . $this->label;
		return $class->$label;
	}
329716
protected function determinePath(array $languages): string
	{
		$path = '/';

		$server = $this->server->all();

		if(isset($server['PATH_INFO']))
		{
			$path = $server['PATH_INFO'];
		}
		elseif(isset($server['REQUEST_URI']))
		{
			if($path = parse_url($server['REQUEST_URI'], PHP_URL_PATH))
			{
				// Remove base path from the request path

				$basePath = pathinfo($server['SCRIPT_NAME'], PATHINFO_DIRNAME);

				if($basePath !== '/' && stripos($path, $basePath) === 0)
				{
					$path = mb_substr($path, mb_strlen($basePath));
				}

				// Remove "/index.php" from the path

				if(stripos($path, '/' . $this->scriptName) === 0)
				{
					$path = mb_substr($path, (strlen($this->scriptName) + 1));
				}

				$path = rawurldecode($path);
			}
		}

		return $this->stripLocaleSegment($languages, $path);
	}
1135340
public function findByLanguage($language)
    {
        $language = Text::toLower($language);
        foreach ($this->getAvailable() as $locale) {
            if ($language == $locale->getLanguage(Text::LOWER)) {
                return $locale;
            }
        }

        return null;
    }
233309
public function translationsAction($language)
    {
        $language = $this->getUser()->getInterfaceLanguage($language);

        $translations = $this->get('resourcesTranslations');
        $content = $translations->get($language);

        return new Response($content, 200, ['Content-Type' => 'text/javascript']);
    }
616622
public function byLanguage($language = null)
    {
        if (!$language) {
            if (Yii::$app->id === 'app-backend') {
                $language = Yii::$app->wavecms->editedLanguage;
            } else {
                $language = Yii::$app->language;
            }
        }

        return $this->andWhere(['REGEXP', News::tableName() . '.languages', '(^|;)(' . $language . ')(;|$)']);
    }
898570
public function getLanguageURLPrefix($lang = null)
    {
        // if active lang is not passed in, use current active
        if (!$lang) {
            $lang = $this->getLanguage();
        }

        return $this->isIncludeDefaultLanguage($lang) ? '/' . $lang : '';
    }
984188
public function getTitle($language = null)
    {
        $fallbackLanguage = key($this->titles);
        if ($language === null) {
            $language = $fallbackLanguage;
        }

        if (!empty($this->titles[$language])) {
            return $this->titles[$language];
        }

        if (!empty($this->titles[$fallbackLanguage])) {
            return $this->titles[$fallbackLanguage];
        }

        $title = false;
        try {
            $defaultUrl = $this->getDefaultUrl();

            if ($defaultUrl) {
                $title = $defaultUrl->getHostname();
            }
        } catch (\Exception $e) {
        }

        if (!$title) {
            return '(No title)';
        }

        return $title;
    }
566821
static function getLangByUrl($url = null)
    {
        if ($url === null) {
            return null;
        } else {
            $language = Lang::find()->where('url = :url', [':url' => $url])->one();
            if ( $language === null ) {
                return null;
            }else{
                return $language;
            }
        }
    }
604540
public function getLoc($element, $language = null)
    {
        return $this
            ->router
            ->generate($element, [
                '_locale' => $language,
            ], false);
    }
1259848
public function getPath($languageCode)
    {
        $route = $this->routes()->newQuery()
            ->where('language_code', $languageCode)
            ->first();
        if (empty($route->path)) {
            throw new DomainException("There is no route in '$languageCode' language for content: $this->id");
        }
        return $route->path;
    }
617394
public static function getLang($language)
    {
        $pos = strpos($language, '-');
        return $pos > 0 ? substr($language, 0, $pos) : $language;
    }
958865
public function stripLanguage($path, $language = null)
    {
        $strip = '/' . ( isset($language) ? $language : $this->getLanguage() );

        if ( strlen($strip) > 1 && strpos($path, $strip) === 0 ) {
            $path = substr($path, strlen($strip));
        }

        return $path;
    }
577822
public function getLanguagePath($basePath = ANPATH_BASE, $language = null )
	{
		$dir = $basePath.DS.'language';

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

		return $dir;
	}
177878
public function withLanguage(string $language): self
    {
        $provider = clone $this;

        $provider->language = $this->getLanguage($language);

        return $provider;
    }
1032932
public function getLanguageCode($language = null)
    {
        if ($language === null) {
            $language = $this->_language;
        }
        $code = KlarnaLanguage::getCode($language);

        return (string) $code;
    }