예제 #1
0
 function test_getLanguageName_uc()
 {
     $h = fbISO639_Alpha3::getidtonamehash();
     foreach ($h as $id => $name) {
         $id = strtoupper($id);
         $rv = fbISO639_Alpha3::getLanguageName($id);
         $this->assertEquals($name, $rv, "id={$id}");
     }
 }
예제 #2
0
        $rv .= ' ??';
    }
    $id2 = fbISO639_Map::getID2($id3);
    $language .= " ({$id2})";
    printf("%-3s\t%-40s\t", $id3, $language);
    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];
    //	}
    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);
예제 #3
0
파일: Alpha3.php 프로젝트: Artea/freebeer
 function getLanguageName($id3)
 {
     $ID3_TO_NAME_HASH =& fbISO639_Alpha3::getIDToNameHash();
     $id3 = strtoupper($id3);
     return isset($ID3_TO_NAME_HASH[$id3]) ? $ID3_TO_NAME_HASH[$id3] : false;
 }
예제 #4
0
$locales[$default_locale] = $default_locale_name;
$locales['en_US'] = 'English.United States';
$locales['en_GB'] = 'English.United Kingdom';
ksort($locales);
$long_month_names_hash = array();
$long_weekday_names_hash = array();
foreach ($locales as $locale => $language) {
    $rv = fbLocale::pushLocale(LC_ALL, $locale);
    //echo "fbLocale::pushLocale(LC_ALL, $locale) returned '$rv'\n";
    $name = $locale;
    $language_id = substr($locale, 0, 2);
    $language = fbISO639::getLanguageName($language_id);
    $country_id = substr($locale, 3, 2);
    $country = fbISO3166::getCountryName($country_id);
    $id3 = fbISO639_Map::getID3($language_id);
    $language3 = fbISO639_Alpha3::getLanguageName($id3);
    $name .= " ({$language}";
    if ($language3 != $language) {
        $name .= ' [' . $language3 . ']';
    }
    $name .= "/{$country}/{$id3})";
    $string = '<i>Unavailable</i>';
    $long_date = '';
    $short_date = '';
    $datetime = '';
    $number = '';
    $money = '';
    $charset = '';
    $codepage = '';
    $locale_name = fbLocale::getLocale();
    $long_month_names = '&nbsp;';
예제 #5
0
파일: Locale.php 프로젝트: Artea/freebeer
 function _setLocaleWindows($category, $locale)
 {
     fbDebug::enter();
     static $locale_cache = array();
     if (isset($locale_cache[$locale])) {
         return fbLocale::_setLocale($category, $locale_cache[$locale]);
     }
     $language_id2 = $locale;
     if (preg_match('/^([^_]+)_(.*)$/', $locale, $matches)) {
         $language_id2 = $matches[1];
         $country_id2 = $matches[2];
     }
     fbDebug::dump($language_id2, '$language_id2');
     do {
         // get the full language name for the ISO 639 2 character language code
         $language_name = fbISO639::getLanguageName($language_id2);
         fbDebug::dump($language_name, '$language_name');
         if (!$language_id2) {
             // if it's not a valid language, then try the locale and return
             $rv = fbLocale::_setLocale($category, $locale);
             break;
         }
         // first, try the full language name
         $rv = fbLocale::_setLocale($category, $language_name);
         if ($rv) {
             break;
         }
         $language_id3 = fbISO639_Alpha3::getLanguageID($language_name);
         fbDebug::dump($language_id3, '$language_id3');
         if (!$language_id3) {
             $rv = fbLocale::_setLocale($category, $locale);
             break;
         }
         // next, try the ISO 639 3 character language code
         $rv = fbLocale::_setLocale($category, $language_id3);
         if ($rv) {
             break;
         }
         // next, try the ISO 639 2 character language code
         $rv = fbLocale::_setLocale($category, $language_id2);
         if ($rv) {
             break;
         }
         // finally, try the original locale
         $rv = fbLocale::_setLocale($category, $locale);
     } while (false);
     $locale_cache[$locale] = $rv;
     fbDebug::leave($rv);
     return $rv;
 }