예제 #1
0
    printf("%-12s\t%-10s\t%-10s\t%-10s", strftime("%A", $date), strftime("%a", $date), strftime("%B", $date), strftime("%b", $date), strftime("%c", $date));
    //	if (isset($supported_locales[$rv])) {
    //		echo $supported_locales[$rv];
    //	}
    echo "\n";
    @($supported_locales[$rv] .= $id3 . ' ');
    resetlocale();
}
echo "\nsetlocale('language name')\n\n";
$language_id3_hash = fbISO639_Alpha3::getNameToIDHash();
foreach ($language_id3_hash as $language => $id3) {
    $rv = setlocale(LC_ALL, $language);
    if (!$rv) {
        continue;
    }
    $a = fbLocale::_parseLocale($rv);
    //print_r($a);
    if (isset($supported_locales[$rv])) {
        //		$supported_locales[$rv] .= $id3 . ' ';
        continue;
    }
    if (strpos($rv, $language) === false) {
        $rv .= ' ??';
    }
    $id2 = fbISO639_Map::getID2($id3);
    $ids = $id3 . ' ' . $id2;
    printf("%-40s%-10s\t", $language, $ids);
    printf("%-40s\t", $rv);
    printf("%-12s\t%-10s\t%-10s\t%-10s", strftime("%A", $date), strftime("%a", $date), strftime("%B", $date), strftime("%b", $date), strftime("%c", $date));
    //	if (isset($supported_locales[$rv])) {
    //		echo $supported_locales[$rv];
예제 #2
0
파일: Locale.php 프로젝트: Artea/freebeer
 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;
 }