Function returns shop url by given language.
#680 per language another URL

@param integer $lang Language id.
@param bool    $ssl  Whether to use ssl.

@return null|string
549814
public function getShopUrlByLanguage($lang, $ssl = false)
    {
        $configParameter = $ssl ? 'aLanguageSSLURLs' : 'aLanguageURLs';
        $lang = isset($lang) ? $lang : Registry::getLang()->getBaseLanguage();
        $languageURLs = $this->getConfigParam($configParameter);
        if (isset($lang) && isset($languageURLs[$lang]) && !empty($languageURLs[$lang])) {
            $languageURLs[$lang] = Registry::getUtils()->checkUrlEndingSlash($languageURLs[$lang]);
            return $languageURLs[$lang];
        }
    }
555777
public function getEmailAddress($lang = 'en')
    {
        $action = "get_email_address";
        $options = array(
            'lang' => $lang,
            'sid_token' => $this->sid_token,
        );

        return $this->client->get($action, $options);
    }
835161
public function getLangBrowserByCurrentUser($forceLang = '')
    {
        $allLangAvailable = $this->availableLanguages();
        $isLangAvailable = function ($langToCheck) use ($allLangAvailable) {
            return in_array($langToCheck, $allLangAvailable);
        };
        // we can force the lang
        if ($forceLang && $isLangAvailable($forceLang)) {
            return $forceLang;
        }
        // or set by session
        if (isset($_SESSION)
            && isset($_SESSION[self::CURRENT_LANG])
            && $isLangAvailable($_SESSION[self::CURRENT_LANG])
        ) {
            return $_SESSION[self::CURRENT_LANG];
        }

        $langBrowser = $this->config->languageBrowser();
        if ($isLangAvailable($langBrowser)) {
            return $langBrowser;
        }

        return $this->defaultLanguage();
    }
978277
public static function lang($lang = null)
    {
        if ($lang)
        {
            self::$lang = strtolower(str_replace(self::$_langNormalizeSearch, self::$_langNormalizeReplace, $lang));
        }
        return self::$lang;
    }
950164
public function getOutUrl($ssl = null, $admin = null, $nativeImg = false)
    {
        $ssl = is_null($ssl) ? $this->isSsl() : $ssl;
        $admin = is_null($admin) ? $this->isAdmin() : $admin;

        if ($ssl) {
            if ($nativeImg && !$admin) {
                $url = $this->getSslShopUrl();
            } else {
                $url = $this->getConfigParam('sSSLShopURL');
                if (!$url && $admin) {
                    $url = $this->getConfigParam('sAdminSSLURL') . '../';
                }
            }
        } else {
            $url = ($nativeImg && !$admin) ? $this->getShopUrl() : $this->getConfigParam('sShopURL');
        }

        return $url . $this->_sOutDir . '/';
    }
1080527
public static function get($args, $lang = null)
    {
        $lang = !is_null($lang) ? $lang : self::getLanguage();
        $args = is_array($args) ? $args : [$args, null];

        $text = $args[0];
        //unset($args[0]);

        $hash = md5($text);

        if (count(self::$translations) == 0) {
            if (file_exists(self::getFilePath())) {
                $json = file_get_contents(self::getFilePath());
                self::$translations = json_decode($json, true);
            }
        }

        if (isset(self::$translations[$hash])
            && isset(self::$translations[$hash][$lang])
        ) {
            if (!empty(self::$translations[$hash][$lang])) {
                $args[0] = self::$translations[$hash][$lang];
                return call_user_func_array('sprintf', $args);
            }
        } else {
            self::$translations[$hash]['origin'] = $text;
            foreach (self::getAvailableLanguages() as $language) {
                if (!isset(self::$translations[$hash][$language])) {
                    self::$translations[$hash][$language] = '';
                }
            }
            $json = json_encode(
                self::$translations,
                JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE
            );
            file_put_contents(self::getFilePath(), $json);
            self::$translations = json_decode($json, true);
        }

        return call_user_func_array('sprintf', $args);
    }
334252
public function getLanguageCode($lang = null)
    {
        $parts = $this->_callInternalLocale('parseLocale', null, $lang, false);
        return isset($parts['language']) ? $parts['language'] : null;
    }
984127
public function fetchSeoUrl($standardUrl, $languageId = null)
    {
        $database = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
        $languageId = isset($languageId) ? ((int) $languageId) : \OxidEsales\Eshop\Core\Registry::getLang()->getBaseLanguage();

        $shopId = \OxidEsales\Eshop\Core\Registry::getConfig()->getShopId();

        $utilsUrl = \OxidEsales\Eshop\Core\Registry::getUtilsUrl();
        $urlParameters = $utilsUrl->stringToParamsArray($standardUrl);
        $noPageNrStandardUrl = $utilsUrl->cleanUrlParams($utilsUrl->cleanUrl($standardUrl, ['pgNr']));
        $postfix = isset($urlParameters['pgNr']) ? 'pgNr=' . $urlParameters['pgNr'] : '';

        $query = "SELECT `oxseourl` FROM `oxseo` WHERE `oxstdurl` = ? AND `oxlang` = ? AND `oxshopid` = ? LIMIT 1";
        $result = $database->getOne($query, [$noPageNrStandardUrl, $languageId, $shopId]);
        $result = ((false !== $result) && !empty($postfix)) ? $utilsUrl->appendParamSeparator($result) . $postfix : $result;

        return $result;
    }
145953
public function get(string $openid, string $lang = 'zh_CN')
    {
        $params = [
            'openid' => $openid,
            'lang' => $lang,
        ];

        return $this->httpGet('cgi-bin/user/info', $params);
    }
203793
public static function languageToTerritory($lang) {
        $config = Zend_Registry::get('config');
        $territory = isset($config->resources->locale->territories->{$lang}) ?
            $config->resources->locale->territories->{$lang} :
            Zend_Locale::getLocaleToTerritory($lang);
        return $territory;
    }
998378
public function getTemplateUrl($file = null, $admin = false, $ssl = null, $lang = null)
    {
        return $this->getShopMainUrl() . $this->getDir($file, $this->_sTemplateDir, $admin, $lang, null, null, false);
    }
615990
public function url($url = null, $full = false) {
		if (CakePlugin::loaded('I18n')) {
			$url = Common::url($url);
			if (is_array($url) && !array_key_exists('lang', $url)) {
				$url['lang'] = Configure::read('Config.language');
			}
		}

		return parent::url($url, $full);
	}
334187
public function getGoogleMapAddressLanguage()
    {
        return $this->scopeConfig->getValue(
            self::XML_GOOGLE_MAP_ADDRESS_LANGUAGE,
            \Magento\Store\Model\ScopeInterface::SCOPE_STORE
        );
    }
650151
public CouchDB useSSL(String yesOrNo) {
        if (yesOrNo == null || !"yes".equals(yesOrNo) || !"no".equals(yesOrNo)) {
            throw new IllegalArgumentException("The strings yes or no are the only valid options for the use ssl " +
                    "option");
        }
        return setParam("use_ssl", yesOrNo);
    }
1114806
public function getMallShopUrl($ssl = false)
    {
        $configParameter = $ssl ? 'sMallSSLShopURL' : 'sMallShopURL';
        $mallShopUrl = $this->getConfigParam($configParameter);
        if ($mallShopUrl) {
            return Registry::getUtils()->checkUrlEndingSlash($mallShopUrl);
        }
    }
1025928
public static function language(string $lang = 'en', string $locale = 'en') : string
    {
        return static::languages($locale)->get($lang);
    }
210514
public static function getBrowserLanguage($browserLang = null)
    {
        static $replacementPatterns = array(
            // extraneous bits of RFC 3282 that we ignore
            '/(\\\\.)/', // quoted-pairs
            '/(\s+)/', // CFWcS white space
            '/(\([^)]*\))/', // CFWS comments
            '/(;q=[0-9.]+)/', // quality

            // found in the LANG environment variable
            '/\.(.*)/', // charset (e.g., en_CA.UTF-8)
            '/^C$/', // POSIX 'C' locale
        );

        if (is_null($browserLang)) {
            $browserLang = self::sanitizeInputValues(@$_SERVER['HTTP_ACCEPT_LANGUAGE']);
            if (empty($browserLang) && self::isPhpCliMode()) {
                $browserLang = @getenv('LANG');
            }
        }

        if (empty($browserLang)) {
            // a fallback might be to infer the language in HTTP_USER_AGENT (i.e., localized build)
            $browserLang = "";
        } else {
            // language tags are case-insensitive per HTTP/1.1 s3.10 but the region may be capitalized per ISO3166-1;
            // underscores are not permitted per RFC 4646 or 4647 (which obsolete RFC 1766 and 3066),
            // but we guard against a bad user agent which naively uses its locale
            $browserLang = strtolower(str_replace('_', '-', $browserLang));

            // filters
            $browserLang = preg_replace($replacementPatterns, '', $browserLang);

            $browserLang = preg_replace('/((^|,)chrome:.*)/', '', $browserLang, 1); // Firefox bug
            $browserLang = preg_replace('/(,)(?:en-securid,)|(?:(^|,)en-securid(,|$))/', '$1', $browserLang, 1); // unregistered language tag

            $browserLang = str_replace('sr-sp', 'sr-rs', $browserLang); // unofficial (proposed) code in the wild
        }

        return $browserLang;
    }