Sets the environment's current locale.

@param  string $langCode The locale's language code.
@return void
347148
protected function setLocale($langCode)
    {
        $translator = $this->translator();
        $translator->setLocale($langCode);

        $available = $translator->locales();
        $fallbacks = $translator->getFallbackLocales();

        array_unshift($fallbacks, $langCode);
        $fallbacks = array_unique($fallbacks);

        $locales = [];
        foreach ($fallbacks as $code) {
            if (isset($available[$code])) {
                $locale = $available[$code];
                if (isset($locale['locales'])) {
                    $choices = (array)$locale['locales'];
                    array_push($locales, ...$choices);
                } elseif (isset($locale['locale'])) {
                    array_push($locales, $locale['locale']);
                }
            }
        }

        $locales = array_unique($locales);

        if ($locales) {
            setlocale(LC_ALL, $locales);
        }
    }
632275
public function set($langcode, $context)
    {
        $result = null;
        $this->hook->attach('translation.set.before', $langcode, $context, $result, $this);

        if (isset($result)) {
            return $result;
        }

        $this->setContext($context);
        $this->setLangcode($langcode);

        $result = $this->prepareFiles($langcode);

        $this->hook->attach('translation.set.after', $langcode, $context, $result, $this);
        return (bool) $result;
    }
1344692
public function check_locale_availability(string $langpackcode) : bool {
        global $CFG;

        if (empty($langpackcode)) {
            throw new coding_exception('Invalid language pack code in \\'.__METHOD__.'() call, only non-empty string is allowed');
        }

        // Fetch the correct locale based on ostype.
        if ($CFG->ostype === 'WINDOWS') {
            $stringtofetch = 'localewin';
        } else {
            $stringtofetch = 'locale';
        }

        // Store current locale.
        $currentlocale = $this->set_locale(LC_ALL, 0);

        $locale = get_string_manager()->get_string($stringtofetch, 'langconfig', $a = null, $langpackcode);

        // Try to set new locale.
        $return = $this->set_locale(LC_ALL, $locale);

        // Restore current locale.
        $this->set_locale(LC_ALL, $currentlocale);

        // If $return is not equal to false, it means that setlocale() succeed to change locale.
        return $return !== false;
    }
540316
public void setLocale(Locale l) {
		if (!initialized) {
			super.setLocale(l);
		} else {
			Locale oldLocale = locale;
			locale = l;
			dayChooser.setLocale(locale);
			monthChooser.setLocale(locale);
			firePropertyChange("locale", oldLocale, locale);
		}
	}
1371599
public static function isValidLangCode($langCode)
    {
        $langList = static::activeLanguagesArray();
        foreach ($langList as $lang) {
            if ($lang['code2'] == $langCode) return true;
            if ($lang['code3'] == $langCode) return true;
            if ($lang['code_full'] == $langCode) return true;
        }
        return false;
    }
1278168
public function setLocale($locale)
	{
		if(is_string($locale))
			$locale=CLocale::getInstance($locale);
		$this->sizeFormat['decimalSeparator']=$locale->getNumberSymbol('decimal');
		$this->_locale=$locale;
	}
1076345
public function setLanguageId($langid)
	{
		if ( $langid === $this->getLanguageId() ) { return; }

		$this->_values['langid'] = strtolower( (string) $langid );
		$this->setModified();
	}
1290646
public function setLang($lang_code){
		$lang = $this->dom->metadata->children('dc', true)->language[0];
		$lang[0] = $this->h($lang_code);
		return $lang;
	}
844348
protected function _setLocale() {
		$language = $this->_language->getCurrentUiLang(false);

		return (bool)setlocale(LC_ALL, $language);
	}
676597
public function setCurrentLocale($lang)
    {
        if ($lang === null) {
            $this->currentLanguage = null;
            return;
        }

        if (!$this->hasLocale($lang)) {
            if (!is_string($lang)) {
                $lang = is_object($lang) ? get_class($lang) : gettype($lang);
            }

            throw new InvalidArgumentException(sprintf(
                'Unsupported language; must be one of "%s", received "%s"',
                implode(', ', $this->availableLocales()),
                $lang
            ));
        }

        $this->currentLanguage = $lang;
    }
69694
public function setLocale($locale)
    {
        $locale = substr($locale, 0, 2);
        if (in_array($locale, $this->locales)) {
            $this->locale = $locale;
            return true;
        }
        return false;
    }
905746
public static function setLang($lang)
    {
        phpCAS::_validateClientExists();

        try {
            self::$_PHPCAS_CLIENT->setLang($lang);
        } catch (Exception $e) {
            phpCAS :: error(get_class($e) . ': ' . $e->getMessage());
        }
    }
463561
public static function setLocale($locale)
    {
        static::getDefaultLocale();
        Locale::setDefault($locale);
        if (isset(static::$_collection)) {
            static::translators()->setLocale($locale);
        }
    }
1370872
public function setLanguage($value)
    {
        //$value = strtolower($value);
        if (!isset($this->_models[$value])) {
            $this->_models[$value] = $this->getNewTranslation($value);
        }
        $this->_language = $value;
    }
1029983
public function setLocale($locale, $ignoreAvailable = false)
    {
        if ($ignoreAvailable || in_array($locale, $this->availableLocales)) {
            $this->currentLocale = $locale;
        } else {
            $this->currentLocale = null;
        }
    }
683728
public static function setLanguageForSession($languageCode)
    {
        if (!API::getInstance()->isLanguageAvailable($languageCode)) {
            return false;
        }

        $cookieName = Config::getInstance()->General['language_cookie_name'];
        $cookie = new Cookie($cookieName, 0);
        $cookie->set('language', $languageCode);
        $cookie->setSecure(ProxyHttp::isHttps());
        $cookie->save();
        return true;
    }
597863
public function setCode(string $code)
    {
        if ($code) {
            $this->selectLocale = strtolower($code);
            $this->ready = true;    // set ready for use locale
            $this->checkLocale();
        }
//        \Tracy\Debugger::fireLog('setCode: ' . $code);
    }