function setLocale($category, $locales) { fbDebug::enter(); assert('$category == LC_ALL || $category == LC_COLLATE ||' . '$category == LC_CTYPE || $category == LC_MONETARY ||' . '$category == LC_NUMERIC || $category == LC_TIME'); static $locale_map = array(); /* // \todo get serialize working $locale_key = is_array($locales) ? serialize($locales) : $locales; fbDebug::dump($locale_key, '$locale_key'); if (!isset($locale_map[$locale_key])) { $locale_map[$locale_key] = fbLocale::getNearestLocale($locales); fbDebug::dump($locale_map, '$locale_map'); } $locale = $locale_map[$locale_key]; if (!$locale) { return setlocale($category, $locales); } */ $locale = $locales; // this appears to be required in order for the gettext functions to work fbSystem::putEnv('LANG', $locale); // it's been reported that this is needed to on some systems fbSystem::putEnv('LANGUAGE', $locale); if (!preg_match('/^win/i', PHP_OS)) { $rv = fbLocale::_setLocale($category, $locale); } else { $rv = fbLocale::_setLocaleWindows($category, $locale); } $_locale_cache =& fbLocale::_locale_cache(); if ($rv && !isset($_locale_cache[$category][$rv])) { $a = fbLocale::_parseLocale($rv); $iso_locale = $a['locale']; $_locale_cache[$category][$rv] = $a; $_locale_cache[$category][$iso_locale] = $a; } fbDebug::leave($rv); return $rv; }