Sets the locale for the complete Logdoc library.

@param newLocale
the new locale, cannot be <code>null</code>.
@throws UnsupportedLocaleException
if the specified locale is not supported by <em>all</em> registered <code>Log</code>
classes.
775435
public static synchronized void setLocale(String newLocale) throws UnsupportedLocaleException {
        Preconditions.checkArgument(newLocale == null, "newLocale == null");
        if (!newLocale.equals(CURRENT_LOCALE)) {
            LogCentral.setLocale(newLocale);
            CURRENT_LOCALE = newLocale;
        }
    }
1316093
@OptionDesc(longName = "locale", shortName = "l",
			description = "citation LOCALE (default: en-US)",
			argumentName = "LOCALE", argumentType = ArgumentType.STRING,
			priority = 30)
	public void setLocale(String locale) {
		this.locale = locale;
	}
138023
public function setLocale($locale) {
        $this->locale   = $locale;
        $this->language = substr($locale, 0, (strpos($locale, '-')));
        $this->messages = array();
    }
227659
public void addDefaultLocale(String localeName) {

        Locale locale = getLocale(localeName);
        if (!m_defaultLocales.contains(locale)) {
            m_defaultLocales.add(locale);
            if (CmsLog.INIT.isInfoEnabled()) {
                CmsLog.INIT.info(
                    Messages.get().getBundle().key(
                        Messages.INIT_I18N_CONFIG_DEFAULT_LOCALE_2,
                        new Integer(m_defaultLocales.size()),
                        locale));

            }
        }
    }
762815
public void updateLocale(String locale) throws SecurityException {
	checkWriteAccess();
	boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_SETTING);
	if (!hasAccess) throw new SecurityException("no access to update regional setting");

	Element scope = _getRootElement("regional");
	scope.setAttribute("locale", locale.trim());
    }
1308770
public void setLocale(Locale locale) throws CmsException {

        CmsUserSettings settings = getSettings();
        if (settings != null) {
            settings.setLocale(locale);
            settings.save(m_cms);
            m_messages = Messages.get().getBundle(locale);
        }
    }
612597
public void setLocales(Locale... locales) {

    String[] array = new String[locales.length];
    for (int i = 0; i < locales.length; i++) {
      array[i] = locales[i].toString();
    }
    setLocales(array);
  }
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);
    }
107674
public void setParseLocale(Object loc) throws JspTagException {
        Locale locale = LocaleUtil.parseLocaleAttributeValue(loc);
        if (loc != null) {
            this.parseLocale = locale;
        }
    }
817764
protected void initHtmlReport(Locale locale) {

        m_report = new CmsWorkplaceReport(locale, m_cms.getRequestContext().getSiteRoot(), getLogChannel());
    }
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
569527
public function setLocale($locale = null)
    {
        $locale = self::_prepareLocale($locale);

        if (isset(self::$_localeData[(string) $locale]) === false) {
            $region = substr((string) $locale, 0, 3);
            if (isset($region[2]) === true) {
                if (($region[2] === '_') or ($region[2] === '-')) {
                    $region = substr($region, 0, 2);
                }
            }

            if (isset(self::$_localeData[(string) $region]) === true) {
                $this->_locale = $region;
            } else {
                $this->_locale = 'root';
            }
        } else {
            $this->_locale = $locale;
        }
    }
197238
public void setLocale(Locale locale)
   {
      List<SimpleDateFormat> formats = new ArrayList<SimpleDateFormat>();
      for (SimpleDateFormat format : m_formats)
      {
         formats.add(new SimpleDateFormat(format.toPattern(), locale));
      }

      m_formats = formats.toArray(new SimpleDateFormat[formats.size()]);
   }
514247
public static void setLocale(@NonNull Locale locale) {
        if (!locale.equals(Locale.getDefault())) {
            LocalizationHelper.locale = locale;
            Locale.setDefault(locale);
        }
    }
130599
public static function setLocale($locale=null)
    {
        global $CFG, $TSUGI_LOCALE, $TSUGI_LOCALE_RELOAD;

        // No internationalization support
        if ( isset($CFG->legacytranslation) ) {
            if ( ! function_exists('bindtextdomain') ) return;
            if ( ! function_exists('textdomain') ) return;
        }

        if ( isset($CFG->legacytranslation) && $locale && 
            strpos($locale, 'UTF-8') === false ) $locale = $locale . '.UTF-8';

        if ( $locale === null && isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ) {

            if ( class_exists('\Locale') ) {
                try {
                    // Symfony may implement a stub for this function that throws an exception
                    $locale = \Locale::acceptFromHttp($_SERVER['HTTP_ACCEPT_LANGUAGE']);
                } catch (exception $e) { }
            }
            if ($locale === null) { // Crude fallback if we can't use Locale::acceptFromHttp
                $pieces = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
                $locale = $pieces[0];
            }
        }

        if ( $locale === null && isset($CFG->fallbacklocale) && $CFG->fallbacklocale ) {
            $locale = $CFG->fallbacklocale;
        }

        if ( $locale === null ) return;

        $locale = str_replace('-','_',$locale);
        if ( isset($CFG->legacytranslation) ) {
            putenv('LC_ALL='.$locale);
            setlocale(LC_ALL, $locale);
        }
        // error_log("setLocale=$locale");
        if ( $TSUGI_LOCALE != $locale ) $TSUGI_LOCALE_RELOAD = true;
        $TSUGI_LOCALE = $locale;
    }
1295467
private function setLocale($locale)
    {
        if($locale != null)
        {
            \Locale::setDefault($locale);
        }
        else 
        {
           \Locale::setDefault(self::CURRENCY_DEFAULT_LOCALE); 
        }
        
        $this->locale = \Locale::getDefault();
    }
1202157
private static void localize( final Class<?> i18nClass,
                                  final Locale locale ) {
        assert i18nClass != null;
        assert locale != null;
        // Create a class-to-problem map for this locale if one doesn't exist, else get the existing one.
        Map<Class<?>, Set<String>> classToProblemsMap = new ConcurrentHashMap<Class<?>, Set<String>>();
        Map<Class<?>, Set<String>> existingClassToProblemsMap = LOCALE_TO_CLASS_TO_PROBLEMS_MAP.putIfAbsent(locale,
                                                                                                            classToProblemsMap);
        if (existingClassToProblemsMap != null) {
            classToProblemsMap = existingClassToProblemsMap;
        }
        // Check if already localized outside of synchronization block for 99% use-case
        if (classToProblemsMap.get(i18nClass) != null) {
            return;
        }
        synchronized (i18nClass) {
            // Return if the supplied i18n class has already been localized to the supplied locale, despite the check outside of
            // the synchronization block (1% use-case), else create a class-to-problems map for the class.
            Set<String> problems = classToProblemsMap.get(i18nClass);
            if (problems == null) {
                problems = new CopyOnWriteArraySet<String>();
                classToProblemsMap.put(i18nClass, problems);
            } else {
                return;
            }
            // Get the URL to the localization properties file ...
            final String localizationBaseName = i18nClass.getName();
            URL bundleUrl = ClasspathLocalizationRepository.getLocalizationBundle(i18nClass.getClassLoader(), localizationBaseName, locale);
            if (bundleUrl == null && i18nClass == CommonI18n.class) {
                throw new SystemFailureException("CommonI18n.properties file not found in classpath !");
            }
            if (bundleUrl == null) {
                LOGGER.warn(CommonI18n.i18nBundleNotFoundInClasspath,
                            ClasspathLocalizationRepository.getPathsToSearchForBundle(localizationBaseName, locale));
                // Nothing was found, so try the default locale
                Locale defaultLocale = Locale.getDefault();
                if (!defaultLocale.equals(locale)) {
                    bundleUrl = ClasspathLocalizationRepository.getLocalizationBundle(i18nClass.getClassLoader(), localizationBaseName, defaultLocale);
                }
                // Return if no applicable localization file could be found
                if (bundleUrl == null) {
                    LOGGER.error(CommonI18n.i18nBundleNotFoundInClasspath,
                                 ClasspathLocalizationRepository.getPathsToSearchForBundle(localizationBaseName, defaultLocale));
                    LOGGER.error(CommonI18n.i18nLocalizationFileNotFound, localizationBaseName);
                    problems.add(CommonI18n.i18nLocalizationFileNotFound.text(localizationBaseName));
                    return;
                }
            }
            // Initialize i18n map
            Properties props = prepareBundleLoading(i18nClass, locale, bundleUrl, problems);

            try {
                InputStream propStream = bundleUrl.openStream();
                try {
                    props.load(propStream);
                    // Check for uninitialized fields
                    for (Field fld : i18nClass.getDeclaredFields()) {
                        if (fld.getType() == I18n.class) {
                            try {
                                I18n i18n = (I18n)fld.get(null);
                                if (i18n.localeToTextMap.get(locale) == null) {
                                    i18n.localeToProblemMap.put(locale,
                                                                CommonI18n.i18nPropertyMissing.text(fld.getName(), bundleUrl));
                                }
                            } catch (IllegalAccessException notPossible) {
                                // Would have already occurred in initialize method, but allowing for the impossible...
                                problems.add(notPossible.getMessage());
                            }
                        }
                    }
                } finally {
                    propStream.close();
                }
            } catch (IOException err) {
                problems.add(err.getMessage());
            }
        }
    }