/** * Set locale of output data * * @param string $locale Name of locale, the same format of setlocale php function * * @return Localize Current instance of that class, for chaining methods */ public static function setLocale($locale) { $locales = array($locale . '.utf-8', $locale . '.UTF-8', $locale); $os = strtolower(php_uname('s')); if (strpos($os, 'windows') !== false) { $locales = array(Formats::$windowsLocaleMap[$locale]); } if (!setlocale(LC_ALL, $locales)) { throw new LocaleException("Locale {$locale} não disponível no seu sistema."); } self::$currentLocale = $locale; return new static(); }