Пример #1
0
function ut_main()
{
    $locales = array(Locale::VALID_LOCALE, Locale::ACTUAL_LOCALE, 100, -100, -9999999999999, 9999999999999, 1.2);
    $coll = ut_coll_create('en_US');
    $res_str = '';
    foreach ($locales as $locale) {
        $rc = ut_coll_get_locale($coll, $locale);
        $res_str .= sprintf("Locale of type %s is %s\n", dump($locale), dump($rc));
    }
    return $res_str . "\n";
}
Пример #2
0
function ut_main()
{
    $res_str = '';
    $locales = array('EN-US-ODESSA', 'UK_UA_ODESSA', 'uk-ua_CALIFORNIA@currency=;currency=GRN', '', 'root', 'uk@currency=EURO', '1234567891113151719212325272931333537394143454749515357596163656769717375777981838587899193959799');
    foreach ($locales as $locale) {
        // Create Collator with the current locale.
        $coll = ut_coll_create($locale);
        if (!is_object($coll)) {
            $res_str .= "Error creating collator with '{$locale}' locale: " . intl_get_error_message() . "\n";
            continue;
        }
        // Get the requested, valid and actual locales.
        $vloc = ut_coll_get_locale($coll, Locale::VALID_LOCALE);
        $aloc = ut_coll_get_locale($coll, Locale::ACTUAL_LOCALE);
        // Show them.
        $res_str .= "Locale: '{$locale}'\n" . "  ULOC_REQUESTED_LOCALE = '{$locale}'\n" . "  ULOC_VALID_LOCALE     = '{$vloc}'\n" . "  ULOC_ACTUAL_LOCALE    = '{$aloc}'\n";
    }
    return $res_str;
}
Пример #3
0
function ut_main3()
{
    $res_str = '';
    $locales = array('EN-US-ODESSA', 'UK_UA_ODESSA', 'uk-ua_CALIFORNIA@currency=;currency=GRN', '', 'root', 'uk@currency=EURO');
    foreach ($locales as $locale) {
        // Create Collator with the current locale.
        $coll = ut_coll_create($locale);
        if (!is_object($coll)) {
            $res_str .= "Error creating collator with '{$locale}' locale: " . intl_get_error_message() . "\n";
            continue;
        }
        // Get the requested, valid and actual locales.
        $vloc = ut_coll_get_locale($coll, 1);
        // was Locale::VALID_LOCALE
        // Show them.
        $res_str .= "Locale: '{$locale}'\n" . "  ULOC_VALID_LOCALE     = '{$vloc}'\n";
    }
    return $res_str;
}