Пример #1
0
        $iso3166 = fbISO639_ISO3166_Map::getCountryID($id2);
        $locale = strtolower($id2) . '_' . strtoupper($iso3166);
        $rv = setlocale(LC_ALL, $locale);
        if ($rv) {
            break;
        }
        $locale = strtolower($id2) . '_' . strtoupper($id2);
        $rv = setlocale(LC_ALL, $locale);
        if ($rv) {
            break;
        }
        continue 2;
    }
    $a = fbLocale::_parseLocale($rv);
    //print_r($a);
    $id3 = fbISO639_Map::getID3($id2);
    if (strpos($rv, $language) === false) {
        $rv .= ' ??';
    }
    $language .= " ({$id3})";
    printf("%-3s\t%-40s\t", $id2, $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));
    echo "\n";
    $supported_locales[$rv] = $id2 . ' ';
    resetlocale();
}
echo "\nsetlocale('three letter code')\n\n";
$id3_language_hash = fbISO639_Alpha3::getIDToNameHash();
foreach ($id3_language_hash as $id3 => $language) {
    $rv = setlocale(LC_ALL, strtolower($id3));
Пример #2
0
$locales = fbLocale::getAvailableLocales();
$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();