Method to set the locale
@param string $default
@throws \Exception
166916
public static function setLocale($default = null)
    {
        $locale = self::extractLocale($default);
        Logger::log('Set locale to project [' . $locale . ']');
        // Load translations
        putenv("LC_ALL=" . $locale);
        setlocale(LC_ALL, $locale);
        // Load the locale path
        $locale_path = BASE_DIR . DIRECTORY_SEPARATOR . 'locale';
        Logger::log('Set locale dir ' . $locale_path);
        GeneratorHelper::createDir($locale_path);
        bindtextdomain('translations', $locale_path);
        textdomain('translations');
        bind_textdomain_codeset('translations', 'UTF-8');
        Security::getInstance()->setSessionKey(I18nHelper::PSFS_SESSION_LANGUAGE_KEY, substr($locale, 0, 2));
    }
887394
public function setLocale($locale)
    {
        // Handle from locale + country
        switch (strtolower($locale)) {
            // “…”
            case 'pt-br':
                $this->opening = Fixer::LDQUO;
                $this->openingSuffix = '';
                $this->closing = Fixer::RDQUO;
                $this->closingPrefix = '';

                return;
        }

        // Handle from locale only
        $short = Fixer::getLanguageFromLocale($locale);

        switch ($short) {
            // « … »
            case 'fr':
                $this->opening = Fixer::LAQUO;
                $this->openingSuffix = Fixer::NO_BREAK_SPACE;
                $this->closing = Fixer::RAQUO;
                $this->closingPrefix = Fixer::NO_BREAK_SPACE;
                break;
            // «…»
            case 'hy':
            case 'az':
            case 'hz':
            case 'eu':
            case 'be':
            case 'ca':
            case 'el':
            case 'it':
            case 'no':
            case 'fa':
            case 'lv':
            case 'pt':
            case 'ru':
            case 'es':
            case 'uk':
                $this->opening = Fixer::LAQUO;
                $this->openingSuffix = '';
                $this->closing = Fixer::RAQUO;
                $this->closingPrefix = '';
                break;
            // „…“
            case 'de':
            case 'ka':
            case 'cs':
            case 'et':
            case 'is':
            case 'lt':
            case 'mk':
            case 'ro':
            case 'sk':
            case 'sl':
            case 'wen':
                $this->opening = Fixer::BDQUO;
                $this->openingSuffix = '';
                $this->closing = Fixer::LDQUO;
                $this->closingPrefix = '';
                break;
            // “…”
            case 'en':
            case 'us':
            case 'gb':
            case 'af':
            case 'ar':
            case 'eo':
            case 'id':
            case 'ga':
            case 'ko':
            case 'br':
            case 'th':
            case 'tr':
            case 'vi':
                $this->opening = Fixer::LDQUO;
                $this->openingSuffix = '';
                $this->closing = Fixer::RDQUO;
                $this->closingPrefix = '';
                break;
            // ”…”
            case 'fi':
            case 'sv':
            case 'bs':
                $this->opening = Fixer::RDQUO;
                $this->openingSuffix = '';
                $this->closing = Fixer::RDQUO;
                $this->closingPrefix = '';
                break;
        }
    }
289086
public function setDefault($default) {
        // Check, warn and auto-fix '' (empty) defaults for CHAR NOT NULL columns, changing them
        // to NULL so XMLDB will apply the proper default
        if ($this->type == XMLDB_TYPE_CHAR && $this->notnull && $default === '') {
            $this->errormsg = 'XMLDB has detected one CHAR NOT NULL column (' . $this->name . ") with '' (empty string) as DEFAULT value. This type of columns must have one meaningful DEFAULT declared or none (NULL). XMLDB have fixed it automatically changing it to none (NULL). The process will continue ok and proper defaults will be created accordingly with each DB requirements. Please fix it in source (XML and/or upgrade script) to avoid this message to be displayed.";
            $this->debug($this->errormsg);
            $default = null;
        }
        // Check, warn and autofix TEXT|BINARY columns having a default clause (only null is allowed)
        if (($this->type == XMLDB_TYPE_TEXT || $this->type == XMLDB_TYPE_BINARY) && $default !== null) {
            $this->errormsg = 'XMLDB has detected one TEXT/BINARY column (' . $this->name . ") with some DEFAULT defined. This type of columns cannot have any default value. Please fix it in source (XML and/or upgrade script) to avoid this message to be displayed.";
            $this->debug($this->errormsg);
            $default = null;
        }
        $this->default = $default;
    }
467334
public function setLocale($locale) {
		$this->locale          = trim($locale);
		$this->primaryLanguage = IntlLocale::getPrimaryLanguage($this->locale);
	}
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');
		
	}
885117
public function setDefault($default)
    {
        if ($default !== null && !$this->getDataType()->doesAllowDefault()) {
            throw new LogicException(
                sprintf(
                    'Unable to set default value for the column. The data-type "%s" does not support a default.',
                    $this->getDataType()->getType()
                )
            );
        }

        if (is_array($default)) {
            foreach ($default as $k => $v) {
                $default[$k] = $this->getDataType()->cast($v);
            }
        } elseif ($default !== null) {
            if (!($this->getDataType() instanceof TimeTypeInterface)) {
                $default = $this->getDataType()->cast($default);
            }
        }

        $this->default = $default;
    }
631434
@Override
    public void setup() {

        if (log.isInfoEnabled()) {
            log.info("Setting default locale to [" + newLocale + "]");
        }

        try {
            Locale.setDefault(newLocale);
        } catch (Exception e) {
            log.error("Could not switch locale to ["
                    + newLocale + "]. Continuing with standard locale.", e);
        }
    }
254118
public function setDefaultLocale($locale) {

		$this->defaultLocale = $locale;

		if (NULL === $this->locale) {
			$this->setPhpDefaultLocale($locale);
		}

	}
1333271
public function setDefault($default)
    {
        // Since SQL types cannot be completely mapped to PHP types, a loose
        // comparision is required, but changes to/from NULL must be taken into
        // account.
        if (
            $this->_default === null and $default !== null or
            $this->_default !== null and $default === null or
            $this->_default != $default
        ) {
            $this->_default = $default;
            if ($this->_table) {
                $this->_setDefault();
            }
        }
    }
847305
function setCharset($charset) {
        $locale = setlocale(LC_CTYPE, 0);
        setlocale(LC_CTYPE, 'en_US');
        $this->_charset = strtolower($charset);
        setlocale(LC_CTYPE, $locale);
    }
476649
public function set_translation(\Skeleton\I18n\Translation $translation) {
		if ($this->i18n_available === true) {
			$this->translation = $translation;
		} else {
			throw new \Exception('Translation is not available, class not found');
		}
	}
305424
public function setDefaultLocalization($defaultLocalization)
    {
        $this->defaultLocalization = $defaultLocalization;

        if (!$this->getXDefaultLocalization()) {
            $this->xDefaultLocalization = $defaultLocalization;
        }
    }
791842
public function setLocale($locale = null)
    {
        if (is_null($locale)) {
            $locale = $this->getParent()->getLocale();
        }
        $this->locale = $locale;

        return $this;
    }
525496
public function setLocale($locale)
	{
		$this['config']->set('app.locale', $locale);

		$this['translator']->setLocale($locale);

		$this['events']->fire('locale.changed', array($locale));
	}
138023
public function setLocale($locale) {
        $this->locale   = $locale;
        $this->language = substr($locale, 0, (strpos($locale, '-')));
        $this->messages = array();
    }
609722
public function setDefault($default)
    {
        $default = trim($default);

        if (in_array((string)$default, static::$defaultGravatars)) {
            $this->default = (string)$default;
        } elseif (strpos($default, 'http') !== false && filter_var($default, FILTER_VALIDATE_URL)) {
            $this->default = urlencode($default);
        }

        return $this;
    }
212009
public function setLocale($keys) {
		if (!setlocale(LC_ALL, $keys)) {
			exec('locale -a', $locales);
			$locales = implode("<br />", $locales);
			throw new \Exception(__METHOD__.'<br>setLocale() failed. These are the locales installed on this system:<br />'.$locales);
		}
	}