Set a new current locale by preparing its language strings.

@param	Locale	Locale object to set.
770381
public function setLocale(Locale $newLocale) {
		
		// apply some changes only if new Locale really differs
		if (!$this->currentLocale or ($this->currentLocale and $newLocale->id != $this->currentLocale->id)) {
			
			$this->currentLocale = $newLocale;
				
			// if new language code equals the default one, move lang-strings
			if ($this->defaultLocale and $newLocale->id == $this->defaultLocale->id) {

				$this->strings = $this->defaultStrings;
				$this->defaultStrings = NULL;
				
			// otherwise reload current strings
			} else {
			
				$this->strings = NULL;
				$this->loadStrings();
				
			}
			
		}
		
		// set current locale to all categories
		setlocale(LC_ALL, str_replace('-', '_', $newLocale->getRepresentation()) . '.UTF-8');
		
	}
964759
def _setup_locale(self, locale: str = locales.DEFAULT_LOCALE) -> None:
        
        if not locale:
            locale = locales.DEFAULT_LOCALE

        locale = locale.lower()
        if locale not in locales.SUPPORTED_LOCALES:
            raise UnsupportedLocale(locale)

        self.locale = locale
388471
public function setLocale($locale)
    {
        foreach ($this->datas as $data) {
            $data->getDefinition()->setLocale($locale);
        }
    }
141550
public function setLocalise($locale = 'en-GB', LocaliseInterface $localise = null)
    {
        $locale = LanguageNormalize::toLanguageTag($locale);

        $this->localises[$locale] = $localise;

        return $this;
    }
1261748
public function setContextLocale($context, $locale)
    {
        if (isset($this->contextLocales[$context]) && $this->contextLocales[$context] == $locale) {
            return;
        }
        $this->contextLocales[$context] = $locale;
        if ($context === $this->activeContext) {
            $this->currentLocaleChanged($locale);
        }
    }
314797
private void initializeLocale() {
        final String locale = getProperty(LOCALE, applicationProperties);
        if (locale != null && !"".equals(locale)) {
            final String[] localeParts = locale.split("_");
            if (localeParts.length == 2) {
                currentLocale = new Locale(localeParts[0], localeParts[1]);
            } else {
                currentLocale = new Locale(localeParts[0]);
            }
        } else {
            currentLocale = Locale.getDefault();
        }
        logger.info(Messages.getMessage(CONTEXT_LOCALE_USED), currentLocale);
    }
533737
public function setLocale(Locale $locale)
    {
        putenv('LANG='.$locale);
        setlocale(LC_ALL, [$locale.'.utf8', $locale]);
        $this->curLocale = $locale;
        $this->sessionSegment->set('locale', $locale);
    }
590286
public void setLocale(Locale locale) {
		for (int i = 0; i < 5; i++) {
			components[i].setLocale(locale);
		}
	}
791842
public function setLocale($locale = null)
    {
        if (is_null($locale)) {
            $locale = $this->getParent()->getLocale();
        }
        $this->locale = $locale;

        return $this;
    }
775774
public void setDefaultLocale(String locale) {

        try {
            m_defaultLocale = CmsLocaleManager.getLocale(locale);
        } catch (Exception e) {
            if (CmsLog.INIT.isWarnEnabled()) {
                CmsLog.INIT.warn(Messages.get().getBundle().key(Messages.INIT_NONCRIT_ERROR_0), e);
            }
        }
        if (CmsLog.INIT.isInfoEnabled()) {
            CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_DEFAULT_LOCALE_1, m_defaultLocale));
        }
    }
473202
public function setLocale($locale)
    {
        if (!isset($this->localePreference[$locale])) {
            $localeBase = substr($locale, 0, 2);

            // Strip region from locale if not configured
            if (empty($this->localePreference[$localeBase])) {
                throw new MissingTranslationException(
                    "The locale '$locale' is not present in the list of available locales"
                );
            }

            $locale = $localeBase;
        }

        $this->locale = $locale;
    }
249352
public void addLocale(String locale) {

        m_searchObject.setLocale(locale);
        m_searchObjectChanged = true;
        ValueChangeEvent.fire(this, m_searchObject);
    }
467334
public function setLocale($locale) {
		$this->locale          = trim($locale);
		$this->primaryLanguage = IntlLocale::getPrimaryLanguage($this->locale);
	}
779527
protected void setLocale( HttpServletRequest request, Locale locale )
    {

        HttpSession session = request.getSession();
        if ( locale == null )
        {
            locale = getDefaultLocale();
        }
        session.setAttribute( Globals.LOCALE_KEY, locale );

    }
463561
public static function setLocale($locale)
    {
        static::getDefaultLocale();
        Locale::setDefault($locale);
        if (isset(static::$_collection)) {
            static::translators()->setLocale($locale);
        }
    }
334704
public function setLocale(
        $locale = null
    ) {
        if (empty($locale)) {
            $locale = $this->getDefaultLocale();
        }

        if (empty($locale)) {
            // @todo warning or error
            return;
        }

        /* Conversion for Ubuntu and Mac local settings. */
        if (!setlocale(LC_MONETARY, $locale . '.utf8')) {
            if (!setlocale(LC_MONETARY, $locale . '.UTF-8')) {
                setlocale(LC_MONETARY, 'en_US.UTF-8');
            }
        }

        /* Conversion for Ubuntu and Mac local settings. */
        if (!setlocale(LC_NUMERIC, $locale . '.utf8')) {
            if (!setlocale(LC_NUMERIC, $locale . '.UTF-8')) {
                setlocale(LC_NUMERIC, 'en_US.UTF-8');
            }
        }

        /* Conversion for Ubuntu and Mac local settings. */
        if (!setlocale(LC_TIME, $locale . '.utf8')) {
            if (!setlocale(LC_TIME, $locale . '.UTF-8')) {
                setlocale(LC_TIME, 'en_US.UTF-8');
            }
        }

        \Locale::setDefault($locale);
    }
835452
public void setLocale(String locale) {

        try {
            m_locale = LocaleUtils.toLocale(locale);
        } catch (IllegalArgumentException e) {
            LOG.error(Messages.get().getBundle().key(Messages.ERR_TAG_INVALID_LOCALE_1, "cms:navigation"), e);
            m_locale = null;
        }
    }