mirror of
https://github.com/php/php-src.git
synced 2025-08-16 22:18:50 +02:00
test fixes for ICU 53.1
This commit is contained in:
parent
e3abcf7826
commit
d483e1daca
14 changed files with 731 additions and 18 deletions
|
@ -1,9 +1,8 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
IntlBreakIterator::getLocale(): basic test
|
IntlBreakIterator::getLocale(): basic test
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?>
|
||||||
if (!extension_loaded('intl'))
|
<?php if (version_compare(INTL_ICU_VERSION, '53.1') >= 0) die('skip for ICU < 53.1'); ?>
|
||||||
die('skip intl extension not enabled');
|
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
ini_set("intl.error_level", E_WARNING);
|
ini_set("intl.error_level", E_WARNING);
|
||||||
|
|
20
ext/intl/tests/breakiter_getLocale_basic2.phpt
Normal file
20
ext/intl/tests/breakiter_getLocale_basic2.phpt
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
--TEST--
|
||||||
|
IntlBreakIterator::getLocale(): basic test
|
||||||
|
--SKIPIF--
|
||||||
|
<?php if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?>
|
||||||
|
<?php if (version_compare(INTL_ICU_VERSION, '53.1') < 0) die('skip for ICU >= 53.1'); ?>
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
ini_set("intl.error_level", E_WARNING);
|
||||||
|
ini_set("intl.default_locale", "pt_PT");
|
||||||
|
|
||||||
|
$bi = IntlBreakIterator::createSentenceInstance('pt');
|
||||||
|
|
||||||
|
var_dump($bi->getLocale(0));
|
||||||
|
var_dump($bi->getLocale(1));
|
||||||
|
?>
|
||||||
|
==DONE==
|
||||||
|
--EXPECT--
|
||||||
|
string(4) "root"
|
||||||
|
string(2) "pt"
|
||||||
|
==DONE==
|
|
@ -1,11 +1,9 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Bug #62070: Collator::getSortKey() returns garbage
|
Bug #62070: Collator::getSortKey() returns garbage
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?>
|
||||||
if (!extension_loaded('intl'))
|
<?php if (version_compare(INTL_ICU_VERSION, '49') < 0) die('skip for ICU >= 49'); ?>
|
||||||
die('skip intl extension not enabled');
|
<?php if (version_compare(INTL_ICU_VERSION, '53.1') >= 0) die('skip for ICU < 53.1'); ?>
|
||||||
if (version_compare(INTL_ICU_VERSION, '49') < 0)
|
|
||||||
die('skip ICU >= 49 only');
|
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
$s1 = 'Hello';
|
$s1 = 'Hello';
|
||||||
|
|
15
ext/intl/tests/bug62070_2.phpt
Normal file
15
ext/intl/tests/bug62070_2.phpt
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
--TEST--
|
||||||
|
Bug #62070: Collator::getSortKey() returns garbage
|
||||||
|
--SKIPIF--
|
||||||
|
<?php if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?>
|
||||||
|
<?php if (version_compare(INTL_ICU_VERSION, '53.1') < 0) die('skip for ICU >= 53.1'); ?>
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
$s1 = 'Hello';
|
||||||
|
|
||||||
|
$coll = collator_create('en_US');
|
||||||
|
$res = collator_get_sort_key($coll, $s1);
|
||||||
|
|
||||||
|
echo urlencode($res);
|
||||||
|
--EXPECT--
|
||||||
|
71%3F%3FE%01%09%01%DC%08
|
|
@ -1,8 +1,9 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
create() icu >= 4.8
|
create() icu >= 4.8 && icu < 53.1
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||||
<?php if(version_compare(INTL_ICU_VERSION, '4.8') < 0) print 'skip'; ?>
|
<?php if(version_compare(INTL_ICU_VERSION, '4.8') < 0) print 'skip for ICU >= 4.8'; ?>
|
||||||
|
<?php if (version_compare(INTL_ICU_VERSION, '53.1') >= 0) die('skip for ICU < 53.1'); ?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
82
ext/intl/tests/collator_create3.phpt
Normal file
82
ext/intl/tests/collator_create3.phpt
Normal file
|
@ -0,0 +1,82 @@
|
||||||
|
--TEST--
|
||||||
|
create() icu >= 53.1
|
||||||
|
--SKIPIF--
|
||||||
|
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||||
|
<?php if (version_compare(INTL_ICU_VERSION, '53.1') < 0) die('skip for ICU >= 53.1'); ?>
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Try creating collator with different locales
|
||||||
|
* with Procedural and Object methods.
|
||||||
|
*/
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
include_once( 'ut_common.inc' );
|
||||||
|
ut_run();
|
||||||
|
|
||||||
|
?>
|
||||||
|
--EXPECTF--
|
||||||
|
Locale: 'EN-US-ODESSA'
|
||||||
|
ULOC_REQUESTED_LOCALE = 'EN-US-ODESSA'
|
||||||
|
ULOC_VALID_LOCALE = 'en_US'
|
||||||
|
ULOC_ACTUAL_LOCALE = 'root'
|
||||||
|
Locale: 'UK_UA_ODESSA'
|
||||||
|
ULOC_REQUESTED_LOCALE = 'UK_UA_ODESSA'
|
||||||
|
ULOC_VALID_LOCALE = 'uk'
|
||||||
|
ULOC_ACTUAL_LOCALE = 'uk'
|
||||||
|
Locale: 'uk-ua_CALIFORNIA@currency=;currency=GRN'
|
||||||
|
ULOC_REQUESTED_LOCALE = 'uk-ua_CALIFORNIA@currency=;currency=GRN'
|
||||||
|
ULOC_VALID_LOCALE = 'root'
|
||||||
|
ULOC_ACTUAL_LOCALE = 'root'
|
||||||
|
Locale: ''
|
||||||
|
ULOC_REQUESTED_LOCALE = ''
|
||||||
|
ULOC_VALID_LOCALE = '%s'
|
||||||
|
ULOC_ACTUAL_LOCALE = '%s'
|
||||||
|
Locale: 'root'
|
||||||
|
ULOC_REQUESTED_LOCALE = 'root'
|
||||||
|
ULOC_VALID_LOCALE = 'root'
|
||||||
|
ULOC_ACTUAL_LOCALE = 'root'
|
||||||
|
Locale: 'uk@currency=EURO'
|
||||||
|
ULOC_REQUESTED_LOCALE = 'uk@currency=EURO'
|
||||||
|
ULOC_VALID_LOCALE = 'uk'
|
||||||
|
ULOC_ACTUAL_LOCALE = 'uk'
|
||||||
|
Error creating collator with '1234567891113151719212325272931333537394143454749515357596163656769717375777981838587899193959799' locale: Locale string too long, should be no longer than 80 characters: U_ILLEGAL_ARGUMENT_ERROR
|
|
@ -3,6 +3,7 @@ collator_get_sort_key()
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||||
<?php if (version_compare(INTL_ICU_VERSION, '51.2') < 0) die('skip for ICU >= 51.2'); ?>
|
<?php if (version_compare(INTL_ICU_VERSION, '51.2') < 0) die('skip for ICU >= 51.2'); ?>
|
||||||
|
<?php if (version_compare(INTL_ICU_VERSION, '53.1') >= 0) die('skip for ICU < 53.1'); ?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
98
ext/intl/tests/collator_get_sort_key_variant3.phpt
Normal file
98
ext/intl/tests/collator_get_sort_key_variant3.phpt
Normal file
|
@ -0,0 +1,98 @@
|
||||||
|
--TEST--
|
||||||
|
collator_get_sort_key()
|
||||||
|
--SKIPIF--
|
||||||
|
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||||
|
<?php if (version_compare(INTL_ICU_VERSION, '53.1') < 0) die('skip for ICU >= 53.1'); ?>
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Get sort keys using various locales
|
||||||
|
*/
|
||||||
|
function sort_arrays( $locale, $data )
|
||||||
|
{
|
||||||
|
$res_str = '';
|
||||||
|
|
||||||
|
$coll = ut_coll_create( $locale );
|
||||||
|
|
||||||
|
foreach($data as $value) {
|
||||||
|
$res_val = ut_coll_get_sort_key( $coll, $value );
|
||||||
|
$res_str .= "source: ".$value."\n".
|
||||||
|
"key: ".bin2hex($res_val)."\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
return $res_str;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function ut_main()
|
||||||
|
{
|
||||||
|
$res_str = '';
|
||||||
|
|
||||||
|
// Regular strings keys
|
||||||
|
$test_params = array(
|
||||||
|
'abc', 'abd', 'aaa',
|
||||||
|
'аа', 'а', 'z',
|
||||||
|
'', null , '3',
|
||||||
|
'y' , 'i' , 'k'
|
||||||
|
);
|
||||||
|
|
||||||
|
$res_str .= sort_arrays( 'en_US', $test_params );
|
||||||
|
|
||||||
|
// Sort a non-ASCII array using ru_RU locale.
|
||||||
|
$test_params = array(
|
||||||
|
'абг', 'абв', 'жжж', 'эюя'
|
||||||
|
);
|
||||||
|
|
||||||
|
$res_str .= sort_arrays( 'ru_RU', $test_params );
|
||||||
|
|
||||||
|
// Sort an array using Lithuanian locale.
|
||||||
|
$res_str .= sort_arrays( 'lt_LT', $test_params );
|
||||||
|
|
||||||
|
return $res_str . "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
include_once( 'ut_common.inc' );
|
||||||
|
ut_run();
|
||||||
|
?>
|
||||||
|
--EXPECT--
|
||||||
|
source: abc
|
||||||
|
key: 292b2d01070107
|
||||||
|
source: abd
|
||||||
|
key: 292b2f01070107
|
||||||
|
source: aaa
|
||||||
|
key: 29292901070107
|
||||||
|
source: аа
|
||||||
|
key: 5e090901060106
|
||||||
|
source: а
|
||||||
|
key: 5e0901050105
|
||||||
|
source: z
|
||||||
|
key: 5b01050105
|
||||||
|
source:
|
||||||
|
key: 0101
|
||||||
|
source:
|
||||||
|
key: 0101
|
||||||
|
source: 3
|
||||||
|
key: 1a01050105
|
||||||
|
source: y
|
||||||
|
key: 5901050105
|
||||||
|
source: i
|
||||||
|
key: 3901050105
|
||||||
|
source: k
|
||||||
|
key: 3d01050105
|
||||||
|
source: абг
|
||||||
|
key: 2809131701070107
|
||||||
|
source: абв
|
||||||
|
key: 2809131501070107
|
||||||
|
source: жжж
|
||||||
|
key: 2833333301070107
|
||||||
|
source: эюя
|
||||||
|
key: 28cdd1d501070107
|
||||||
|
source: абг
|
||||||
|
key: 5e09131701070107
|
||||||
|
source: абв
|
||||||
|
key: 5e09131501070107
|
||||||
|
source: жжж
|
||||||
|
key: 5e33333301070107
|
||||||
|
source: эюя
|
||||||
|
key: 5ecdd1d501070107
|
|
@ -1,8 +1,9 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
numfmt_format() icu >= 52.1
|
numfmt_format() icu >= 52.1 && icu < 53.1
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||||
<?php if(version_compare(INTL_ICU_VERSION, '52.1') < 0) print 'skip'; ?>
|
<?php if(version_compare(INTL_ICU_VERSION, '52.1') < 0) print 'skip for ICU >= 52.1'; ?>
|
||||||
|
<?php if (version_compare(INTL_ICU_VERSION, '53.1') >= 0) die('skip for ICU < 53.1'); ?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
130
ext/intl/tests/formatter_format4.phpt
Normal file
130
ext/intl/tests/formatter_format4.phpt
Normal file
|
@ -0,0 +1,130 @@
|
||||||
|
--TEST--
|
||||||
|
numfmt_format() icu >= 53.1
|
||||||
|
--SKIPIF--
|
||||||
|
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||||
|
<?php if (version_compare(INTL_ICU_VERSION, '53.1') < 0) die('skip for ICU >= 53.1'); ?>
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Format a number using misc locales/patterns.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* TODO: doesn't pass on ICU 3.6 because 'ru' and 'de' locales changed
|
||||||
|
* currency and percent formatting.
|
||||||
|
*/
|
||||||
|
|
||||||
|
function ut_main()
|
||||||
|
{
|
||||||
|
$styles = array(
|
||||||
|
NumberFormatter::PATTERN_DECIMAL => '##.#####################',
|
||||||
|
NumberFormatter::DECIMAL => '',
|
||||||
|
NumberFormatter::CURRENCY => '',
|
||||||
|
NumberFormatter::PERCENT => '',
|
||||||
|
NumberFormatter::SCIENTIFIC => '',
|
||||||
|
NumberFormatter::SPELLOUT => '@@@@@@@',
|
||||||
|
NumberFormatter::ORDINAL => '',
|
||||||
|
NumberFormatter::DURATION => '',
|
||||||
|
NumberFormatter::PATTERN_RULEBASED => '#####.###',
|
||||||
|
1234999, // bad one
|
||||||
|
);
|
||||||
|
|
||||||
|
$integer = array(
|
||||||
|
NumberFormatter::ORDINAL => '',
|
||||||
|
NumberFormatter::DURATION => '',
|
||||||
|
);
|
||||||
|
$locales = array(
|
||||||
|
'en_US',
|
||||||
|
'ru_UA',
|
||||||
|
'de',
|
||||||
|
'fr',
|
||||||
|
'en_UK'
|
||||||
|
);
|
||||||
|
|
||||||
|
$str_res = '';
|
||||||
|
$number = 1234567.891234567890000;
|
||||||
|
|
||||||
|
foreach( $locales as $locale )
|
||||||
|
{
|
||||||
|
$str_res .= "\nLocale is: $locale\n";
|
||||||
|
foreach( $styles as $style => $pattern )
|
||||||
|
{
|
||||||
|
$fmt = ut_nfmt_create( $locale, $style, $pattern );
|
||||||
|
|
||||||
|
if(!$fmt) {
|
||||||
|
$str_res .= "Bad formatter!\n";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$str_res .= dump( isset($integer[$style])?ut_nfmt_format( $fmt, $number, NumberFormatter::TYPE_INT32):ut_nfmt_format( $fmt, $number ) ) . "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $str_res;
|
||||||
|
}
|
||||||
|
|
||||||
|
include_once( 'ut_common.inc' );
|
||||||
|
|
||||||
|
// Run the test
|
||||||
|
ut_run();
|
||||||
|
|
||||||
|
?>
|
||||||
|
--EXPECTREGEX--
|
||||||
|
Locale is: en_US
|
||||||
|
'1234567.89123457'
|
||||||
|
'1,234,567.891'
|
||||||
|
'\$1,234,567.89'
|
||||||
|
'123,456,789%'
|
||||||
|
'1.23456789123457E6'
|
||||||
|
'one million,? two hundred (and )?thirty-four thousand,? five hundred (and )?sixty-seven point eight nine one two three four five seven'
|
||||||
|
'1,234,567(th|ᵗʰ)'
|
||||||
|
'342:56:07'
|
||||||
|
'#####.###'
|
||||||
|
'USD1,234,567.89'
|
||||||
|
|
||||||
|
Locale is: ru_UA
|
||||||
|
'1234567,89123457'
|
||||||
|
'1 234 567,891'
|
||||||
|
'1 234 567,89 ?(грн\.|₴)'
|
||||||
|
'123 456 789 ?%'
|
||||||
|
'1,23456789123457E6'
|
||||||
|
'один миллион двести тридцать четыре тысяч пятьсот шестьдесят семь запятая восемь девять один два три четыре пять семь'
|
||||||
|
'1 234 567.?'
|
||||||
|
'1 234 567'
|
||||||
|
'#####.###'
|
||||||
|
'1 234 567,89 UAH'
|
||||||
|
|
||||||
|
Locale is: de
|
||||||
|
'1234567,89123457'
|
||||||
|
'1.234.567,891'
|
||||||
|
'(¤ )?1.234.567,89( ¤)?'
|
||||||
|
'123\.456\.789 %'
|
||||||
|
'1,23456789123457E6'
|
||||||
|
'eine Million zweihundertvierunddreißigtausendfünfhundertsiebenundsechzig Komma acht neun eins zwei drei vier fünf sieben'
|
||||||
|
'1.234.567.?'
|
||||||
|
'1.234.567'
|
||||||
|
'#####.###'
|
||||||
|
'1.234.567,89 ¤¤'
|
||||||
|
|
||||||
|
Locale is: fr
|
||||||
|
'1234567,89123457'
|
||||||
|
'1 234 567,891'
|
||||||
|
'1 234 567,89 ¤'
|
||||||
|
'123 456 789 ?%'
|
||||||
|
'1,23456789123457E6'
|
||||||
|
'un million deux cent trente-quatre mille cinq cent soixante-sept virgule huit neuf un deux trois quatre cinq sept'
|
||||||
|
'1 234 567e'
|
||||||
|
'1 234 567'
|
||||||
|
'#####.###'
|
||||||
|
'1 234 567,89 ¤¤'
|
||||||
|
|
||||||
|
Locale is: en_UK
|
||||||
|
'1234567.89123457'
|
||||||
|
'1,234,567.891'
|
||||||
|
'¤1,234,567.89'
|
||||||
|
'123,456,789%'
|
||||||
|
'1.23456789123457E6'
|
||||||
|
'one million,? two hundred (and )?thirty-four thousand,? five hundred (and )?sixty-seven point eight nine one two three four five seven'
|
||||||
|
'1,234,567(th|ᵗʰ)'
|
||||||
|
'342:56:07'
|
||||||
|
'#####.###'
|
||||||
|
'¤¤1,234,567.89'
|
|
@ -1,8 +1,9 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
locale_get_display_name() icu >= 52.1
|
locale_get_display_name() icu >= 52.1 && icu < 53.1
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||||
<?php if (version_compare(INTL_ICU_VERSION, '52.1') < 0) die('skip for ICU >= 52.1'); ?>
|
<?php if (version_compare(INTL_ICU_VERSION, '52.1') < 0) die('skip for ICU >= 52.1'); ?>
|
||||||
|
<?php if (version_compare(INTL_ICU_VERSION, '53.1') >= 0) die('skip for ICU < 53.1'); ?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
342
ext/intl/tests/locale_get_display_name5.phpt
Normal file
342
ext/intl/tests/locale_get_display_name5.phpt
Normal file
|
@ -0,0 +1,342 @@
|
||||||
|
--TEST--
|
||||||
|
locale_get_display_name() icu >= 53.1
|
||||||
|
--SKIPIF--
|
||||||
|
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||||
|
<?php if (version_compare(INTL_ICU_VERSION, '53.1') < 0) die('skip for ICU >= 53.1'); ?>
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Try getting the display_name for different locales
|
||||||
|
* with Procedural and Object methods.
|
||||||
|
*/
|
||||||
|
|
||||||
|
function ut_main()
|
||||||
|
{
|
||||||
|
$res_str='';
|
||||||
|
|
||||||
|
$disp_locales=array('en','fr','de');
|
||||||
|
|
||||||
|
$locales = array(
|
||||||
|
'sl_IT_nedis_KIRTI',
|
||||||
|
'sl_IT_nedis-a-kirti-x-xyz',
|
||||||
|
'sl_IT_rozaj',
|
||||||
|
'sl_IT_NEDIS_ROJAZ_1901',
|
||||||
|
'i-enochian',
|
||||||
|
'zh-hakka',
|
||||||
|
'zh-wuu',
|
||||||
|
'i-tay',
|
||||||
|
'sgn-BE-nl',
|
||||||
|
'sgn-CH-de',
|
||||||
|
'sl_IT_rozaj@currency=EUR',
|
||||||
|
'uk-ua_CALIFORNIA@currency=;currency=GRN',
|
||||||
|
'root',
|
||||||
|
'uk@currency=EURO',
|
||||||
|
'Hindi',
|
||||||
|
//Simple language subtag
|
||||||
|
'de',
|
||||||
|
'fr',
|
||||||
|
'ja',
|
||||||
|
'i-enochian', //(example of a grandfathered tag)
|
||||||
|
//Language subtag plus Script subtag:
|
||||||
|
'zh-Hant',
|
||||||
|
'zh-Hans',
|
||||||
|
'sr-Cyrl',
|
||||||
|
'sr-Latn',
|
||||||
|
//Language-Script-Region
|
||||||
|
'zh-Hans-CN',
|
||||||
|
'sr-Latn-CS',
|
||||||
|
//Language-Variant
|
||||||
|
'sl-rozaj',
|
||||||
|
'sl-nedis',
|
||||||
|
//Language-Region-Variant
|
||||||
|
'de-CH-1901',
|
||||||
|
'sl-IT-nedis',
|
||||||
|
//Language-Script-Region-Variant
|
||||||
|
'sl-Latn-IT-nedis',
|
||||||
|
//Language-Region:
|
||||||
|
'de-DE',
|
||||||
|
'en-US',
|
||||||
|
'es-419',
|
||||||
|
//Private use subtags:
|
||||||
|
'de-CH-x-phonebk',
|
||||||
|
'az-Arab-x-AZE-derbend',
|
||||||
|
//Extended language subtags
|
||||||
|
'zh-min',
|
||||||
|
'zh-min-nan-Hant-CN',
|
||||||
|
//Private use registry values
|
||||||
|
'x-whatever',
|
||||||
|
'qaa-Qaaa-QM-x-southern',
|
||||||
|
'sr-Latn-QM',
|
||||||
|
'sr-Qaaa-CS',
|
||||||
|
/*Tags that use extensions (examples ONLY: extensions MUST be defined
|
||||||
|
by revision or update to this document or by RFC): */
|
||||||
|
'en-US-u-islamCal',
|
||||||
|
'zh-CN-a-myExt-x-private',
|
||||||
|
'en-a-myExt-b-another',
|
||||||
|
//Some Invalid Tags:
|
||||||
|
'de-419-DE',
|
||||||
|
'a-DE',
|
||||||
|
'ar-a-aaa-b-bbb-a-ccc'
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
$res_str = '';
|
||||||
|
|
||||||
|
foreach( $locales as $locale )
|
||||||
|
{
|
||||||
|
$res_str .= "locale='$locale'\n";
|
||||||
|
foreach( $disp_locales as $disp_locale )
|
||||||
|
{
|
||||||
|
$scr = ut_loc_get_display_name( $locale ,$disp_locale );
|
||||||
|
$scr = str_replace(array('(', ')'), '#', $scr);
|
||||||
|
$res_str .= "disp_locale=$disp_locale : display_name=$scr";
|
||||||
|
$res_str .= "\n";
|
||||||
|
}
|
||||||
|
$res_str .= "-----------------\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
return $res_str;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
include_once( 'ut_common.inc' );
|
||||||
|
ut_run();
|
||||||
|
|
||||||
|
?>
|
||||||
|
--EXPECTREGEX--
|
||||||
|
locale='sl_IT_nedis_KIRTI'
|
||||||
|
disp_locale=en : display_name=Slovenian #Italy, NEDIS_KIRTI#
|
||||||
|
disp_locale=fr : display_name=slovène #Italie, NEDIS_KIRTI#
|
||||||
|
disp_locale=de : display_name=Slowenisch #Italien, NEDIS_KIRTI#
|
||||||
|
-----------------
|
||||||
|
locale='sl_IT_nedis-a-kirti-x-xyz'
|
||||||
|
disp_locale=en : display_name=Slovenian #Italy, NEDIS_A_KIRTI_X_XYZ#
|
||||||
|
disp_locale=fr : display_name=slovène #Italie, NEDIS_A_KIRTI_X_XYZ#
|
||||||
|
disp_locale=de : display_name=Slowenisch #Italien, NEDIS_A_KIRTI_X_XYZ#
|
||||||
|
-----------------
|
||||||
|
locale='sl_IT_rozaj'
|
||||||
|
disp_locale=en : display_name=Slovenian #Italy, Resian#
|
||||||
|
disp_locale=fr : display_name=slovène #Italie, dialecte de Resia#
|
||||||
|
disp_locale=de : display_name=Slowenisch #Italien, (ROZAJ|Resianisch)#
|
||||||
|
-----------------
|
||||||
|
locale='sl_IT_NEDIS_ROJAZ_1901'
|
||||||
|
disp_locale=en : display_name=Slovenian #Italy, NEDIS_ROJAZ_1901#
|
||||||
|
disp_locale=fr : display_name=slovène #Italie, NEDIS_ROJAZ_1901#
|
||||||
|
disp_locale=de : display_name=Slowenisch #Italien, NEDIS_ROJAZ_1901#
|
||||||
|
-----------------
|
||||||
|
locale='i-enochian'
|
||||||
|
disp_locale=en : display_name=i-enochian #Private-Use=i-enochian#
|
||||||
|
disp_locale=fr : display_name=i-enochian #Usage privé=i-enochian#
|
||||||
|
disp_locale=de : display_name=i-enochian #Privatnutzung=i-enochian#
|
||||||
|
-----------------
|
||||||
|
locale='zh-hakka'
|
||||||
|
disp_locale=en : display_name=Chinese( #HAKKA#)?
|
||||||
|
disp_locale=fr : display_name=chinois( #HAKKA#)?
|
||||||
|
disp_locale=de : display_name=Chinesisch( #HAKKA#)?
|
||||||
|
-----------------
|
||||||
|
locale='zh-wuu'
|
||||||
|
disp_locale=en : display_name=Chinese #WUU#
|
||||||
|
disp_locale=fr : display_name=chinois #WUU#
|
||||||
|
disp_locale=de : display_name=Chinesisch #WUU#
|
||||||
|
-----------------
|
||||||
|
locale='i-tay'
|
||||||
|
disp_locale=en : display_name=i-tay
|
||||||
|
disp_locale=fr : display_name=i-tay
|
||||||
|
disp_locale=de : display_name=i-tay
|
||||||
|
-----------------
|
||||||
|
locale='sgn-BE-nl'
|
||||||
|
disp_locale=en : display_name=sgn #Belgium, NL#
|
||||||
|
disp_locale=fr : display_name=sgn #Belgique, NL#
|
||||||
|
disp_locale=de : display_name=sgn #Belgien, NL#
|
||||||
|
-----------------
|
||||||
|
locale='sgn-CH-de'
|
||||||
|
disp_locale=en : display_name=sgn #Switzerland, DE#
|
||||||
|
disp_locale=fr : display_name=sgn #Suisse, DE#
|
||||||
|
disp_locale=de : display_name=sgn #Schweiz, DE#
|
||||||
|
-----------------
|
||||||
|
locale='sl_IT_rozaj@currency=EUR'
|
||||||
|
disp_locale=en : display_name=Slovenian #Italy, Resian, [Cc]urrency=Euro#
|
||||||
|
disp_locale=fr : display_name=slovène #Italie, dialecte de Resia, [Dd]evise=euro#
|
||||||
|
disp_locale=de : display_name=Slowenisch #Italien, (ROZAJ|Resianisch), Währung=Euro#
|
||||||
|
-----------------
|
||||||
|
locale='uk-ua_CALIFORNIA@currency=;currency=GRN'
|
||||||
|
disp_locale=en : display_name=
|
||||||
|
disp_locale=fr : display_name=
|
||||||
|
disp_locale=de : display_name=
|
||||||
|
-----------------
|
||||||
|
locale='root'
|
||||||
|
disp_locale=en : display_name=Root
|
||||||
|
disp_locale=fr : display_name=racine
|
||||||
|
disp_locale=de : display_name=[Rr]oot
|
||||||
|
-----------------
|
||||||
|
locale='uk@currency=EURO'
|
||||||
|
disp_locale=en : display_name=Ukrainian #[Cc]urrency=EURO#
|
||||||
|
disp_locale=fr : display_name=ukrainien #[Dd]evise=EURO#
|
||||||
|
disp_locale=de : display_name=Ukrainisch #Währung=EURO#
|
||||||
|
-----------------
|
||||||
|
locale='Hindi'
|
||||||
|
disp_locale=en : display_name=hindi
|
||||||
|
disp_locale=fr : display_name=hindi
|
||||||
|
disp_locale=de : display_name=hindi
|
||||||
|
-----------------
|
||||||
|
locale='de'
|
||||||
|
disp_locale=en : display_name=German
|
||||||
|
disp_locale=fr : display_name=allemand
|
||||||
|
disp_locale=de : display_name=Deutsch
|
||||||
|
-----------------
|
||||||
|
locale='fr'
|
||||||
|
disp_locale=en : display_name=French
|
||||||
|
disp_locale=fr : display_name=français
|
||||||
|
disp_locale=de : display_name=Französisch
|
||||||
|
-----------------
|
||||||
|
locale='ja'
|
||||||
|
disp_locale=en : display_name=Japanese
|
||||||
|
disp_locale=fr : display_name=japonais
|
||||||
|
disp_locale=de : display_name=Japanisch
|
||||||
|
-----------------
|
||||||
|
locale='i-enochian'
|
||||||
|
disp_locale=en : display_name=i-enochian #Private-Use=i-enochian#
|
||||||
|
disp_locale=fr : display_name=i-enochian #Usage privé=i-enochian#
|
||||||
|
disp_locale=de : display_name=i-enochian #Privatnutzung=i-enochian#
|
||||||
|
-----------------
|
||||||
|
locale='zh-Hant'
|
||||||
|
disp_locale=en : display_name=Chinese #Traditional#
|
||||||
|
disp_locale=fr : display_name=chinois #traditionnel#
|
||||||
|
disp_locale=de : display_name=Chinesisch #Traditionell#
|
||||||
|
-----------------
|
||||||
|
locale='zh-Hans'
|
||||||
|
disp_locale=en : display_name=Chinese #Simplified#
|
||||||
|
disp_locale=fr : display_name=chinois #simplifié#
|
||||||
|
disp_locale=de : display_name=Chinesisch #Vereinfacht#
|
||||||
|
-----------------
|
||||||
|
locale='sr-Cyrl'
|
||||||
|
disp_locale=en : display_name=Serbian #Cyrillic#
|
||||||
|
disp_locale=fr : display_name=serbe #cyrillique#
|
||||||
|
disp_locale=de : display_name=Serbisch #Kyrillisch#
|
||||||
|
-----------------
|
||||||
|
locale='sr-Latn'
|
||||||
|
disp_locale=en : display_name=Serbian #Latin#
|
||||||
|
disp_locale=fr : display_name=serbe #latin#
|
||||||
|
disp_locale=de : display_name=Serbisch #Lateinisch#
|
||||||
|
-----------------
|
||||||
|
locale='zh-Hans-CN'
|
||||||
|
disp_locale=en : display_name=Chinese #Simplified, China#
|
||||||
|
disp_locale=fr : display_name=chinois #simplifié, Chine#
|
||||||
|
disp_locale=de : display_name=Chinesisch #Vereinfacht, China#
|
||||||
|
-----------------
|
||||||
|
locale='sr-Latn-CS'
|
||||||
|
disp_locale=en : display_name=Serbian #Latin, Serbia#
|
||||||
|
disp_locale=fr : display_name=serbe #latin, Serbie#
|
||||||
|
disp_locale=de : display_name=Serbisch #Lateinisch, Serbien#
|
||||||
|
-----------------
|
||||||
|
locale='sl-rozaj'
|
||||||
|
disp_locale=en : display_name=Slovenian #Resian#
|
||||||
|
disp_locale=fr : display_name=slovène #dialecte de Resia#
|
||||||
|
disp_locale=de : display_name=Slowenisch( #(ROZAJ|Resianisch)#)?
|
||||||
|
-----------------
|
||||||
|
locale='sl-nedis'
|
||||||
|
disp_locale=en : display_name=Slovenian #Natisone dialect#
|
||||||
|
disp_locale=fr : display_name=slovène #dialecte de Natisone#
|
||||||
|
disp_locale=de : display_name=Slowenisch #Natisone-Dialekt#
|
||||||
|
-----------------
|
||||||
|
locale='de-CH-1901'
|
||||||
|
disp_locale=en : display_name=German #Switzerland, Traditional German orthography#
|
||||||
|
disp_locale=fr : display_name=allemand #Suisse, orthographe allemande traditionnelle#
|
||||||
|
disp_locale=de : display_name=Deutsch #Schweiz, (1901|[aA]lte deutsche Rechtschreibung)#
|
||||||
|
-----------------
|
||||||
|
locale='sl-IT-nedis'
|
||||||
|
disp_locale=en : display_name=Slovenian #Italy, Natisone dialect#
|
||||||
|
disp_locale=fr : display_name=slovène #Italie, dialecte de Natisone#
|
||||||
|
disp_locale=de : display_name=Slowenisch #Italien, (NEDIS|Natisone-Dialekt)#
|
||||||
|
-----------------
|
||||||
|
locale='sl-Latn-IT-nedis'
|
||||||
|
disp_locale=en : display_name=Slovenian #Latin, Italy, Natisone dialect#
|
||||||
|
disp_locale=fr : display_name=slovène #latin, Italie, dialecte de Natisone#
|
||||||
|
disp_locale=de : display_name=Slowenisch #Lateinisch, Italien, (NEDIS|Natisone-Dialekt)#
|
||||||
|
-----------------
|
||||||
|
locale='de-DE'
|
||||||
|
disp_locale=en : display_name=German #Germany#
|
||||||
|
disp_locale=fr : display_name=allemand #Allemagne#
|
||||||
|
disp_locale=de : display_name=Deutsch #Deutschland#
|
||||||
|
-----------------
|
||||||
|
locale='en-US'
|
||||||
|
disp_locale=en : display_name=English #United States#
|
||||||
|
disp_locale=fr : display_name=anglais #États-Unis#
|
||||||
|
disp_locale=de : display_name=Englisch #Vereinigte Staaten#
|
||||||
|
-----------------
|
||||||
|
locale='es-419'
|
||||||
|
disp_locale=en : display_name=Spanish #Latin America#
|
||||||
|
disp_locale=fr : display_name=espagnol #Amérique latine#
|
||||||
|
disp_locale=de : display_name=Spanisch #Lateinamerika#
|
||||||
|
-----------------
|
||||||
|
locale='de-CH-x-phonebk'
|
||||||
|
disp_locale=en : display_name=German #Switzerland, Private-Use=phonebk#
|
||||||
|
disp_locale=fr : display_name=allemand #Suisse, Usage privé=phonebk#
|
||||||
|
disp_locale=de : display_name=Deutsch #Schweiz, Privatnutzung=phonebk#
|
||||||
|
-----------------
|
||||||
|
locale='az-Arab-x-AZE-derbend'
|
||||||
|
disp_locale=en : display_name=Azerbaijani #Arabic, Private-Use=aze-derbend#
|
||||||
|
disp_locale=fr : display_name=azéri #arabe, Usage privé=aze-derbend#
|
||||||
|
disp_locale=de : display_name=Aserbaidschanisch #Arabisch, Privatnutzung=aze-derbend#
|
||||||
|
-----------------
|
||||||
|
locale='zh-min'
|
||||||
|
disp_locale=en : display_name=Chinese #MIN#
|
||||||
|
disp_locale=fr : display_name=chinois #MIN#
|
||||||
|
disp_locale=de : display_name=Chinesisch #MIN#
|
||||||
|
-----------------
|
||||||
|
locale='zh-min-nan-Hant-CN'
|
||||||
|
disp_locale=en : display_name=Chinese #MIN, NAN_HANT_CN#
|
||||||
|
disp_locale=fr : display_name=chinois #MIN, NAN_HANT_CN#
|
||||||
|
disp_locale=de : display_name=Chinesisch #MIN, NAN_HANT_CN#
|
||||||
|
-----------------
|
||||||
|
locale='x-whatever'
|
||||||
|
disp_locale=en : display_name=x-whatever #Private-Use=whatever#
|
||||||
|
disp_locale=fr : display_name=x-whatever #Usage privé=whatever#
|
||||||
|
disp_locale=de : display_name=x-whatever #Privatnutzung=whatever#
|
||||||
|
-----------------
|
||||||
|
locale='qaa-Qaaa-QM-x-southern'
|
||||||
|
disp_locale=en : display_name=qaa #Qaaa, QM, Private-Use=southern#
|
||||||
|
disp_locale=fr : display_name=qaa #Qaaa, QM, Usage privé=southern#
|
||||||
|
disp_locale=de : display_name=qaa #Qaaa, QM, Privatnutzung=southern#
|
||||||
|
-----------------
|
||||||
|
locale='sr-Latn-QM'
|
||||||
|
disp_locale=en : display_name=Serbian #Latin, QM#
|
||||||
|
disp_locale=fr : display_name=serbe #latin, QM#
|
||||||
|
disp_locale=de : display_name=Serbisch #Lateinisch, QM#
|
||||||
|
-----------------
|
||||||
|
locale='sr-Qaaa-CS'
|
||||||
|
disp_locale=en : display_name=Serbian #Qaaa, Serbia#
|
||||||
|
disp_locale=fr : display_name=serbe #Qaaa, Serbie#
|
||||||
|
disp_locale=de : display_name=Serbisch #Qaaa, Serbien#
|
||||||
|
-----------------
|
||||||
|
locale='en-US-u-islamCal'
|
||||||
|
disp_locale=en : display_name=English #United States, attribute=islamcal#
|
||||||
|
disp_locale=fr : display_name=anglais #États-Unis, attribute=islamcal#
|
||||||
|
disp_locale=de : display_name=Englisch #Vereinigte Staaten, attribute=islamcal#
|
||||||
|
-----------------
|
||||||
|
locale='zh-CN-a-myExt-x-private'
|
||||||
|
disp_locale=en : display_name=Chinese #China, a=myext, Private-Use=private#
|
||||||
|
disp_locale=fr : display_name=chinois #Chine, a=myext, Usage privé=private#
|
||||||
|
disp_locale=de : display_name=Chinesisch #China, a=myext, Privatnutzung=private#
|
||||||
|
-----------------
|
||||||
|
locale='en-a-myExt-b-another'
|
||||||
|
disp_locale=en : display_name=English #a=myext, b=another#
|
||||||
|
disp_locale=fr : display_name=anglais #a=myext, b=another#
|
||||||
|
disp_locale=de : display_name=Englisch #a=myext, b=another#
|
||||||
|
-----------------
|
||||||
|
locale='de-419-DE'
|
||||||
|
disp_locale=en : display_name=German #Latin America, DE#
|
||||||
|
disp_locale=fr : display_name=allemand #Amérique latine, DE#
|
||||||
|
disp_locale=de : display_name=Deutsch #Lateinamerika, DE#
|
||||||
|
-----------------
|
||||||
|
locale='a-DE'
|
||||||
|
disp_locale=en : display_name=a #Germany#
|
||||||
|
disp_locale=fr : display_name=a #Allemagne#
|
||||||
|
disp_locale=de : display_name=a #Deutschland#
|
||||||
|
-----------------
|
||||||
|
locale='ar-a-aaa-b-bbb-a-ccc'
|
||||||
|
disp_locale=en : display_name=Arabic #a=aaa, b=bbb#
|
||||||
|
disp_locale=fr : display_name=arabe #a=aaa, b=bbb#
|
||||||
|
disp_locale=de : display_name=Arabisch #a=aaa, b=bbb#
|
||||||
|
-----------------
|
|
@ -1,9 +1,8 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
IntlTimeZone::getCanonicalID(): second argument
|
IntlTimeZone::getCanonicalID(): second argument
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?>
|
||||||
if (!extension_loaded('intl'))
|
<?php if (version_compare(INTL_ICU_VERSION, '53.1') >= 0) die('skip for ICU < 53.1'); ?>
|
||||||
die('skip intl extension not enabled');
|
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
ini_set("intl.error_level", E_WARNING);
|
ini_set("intl.error_level", E_WARNING);
|
||||||
|
|
26
ext/intl/tests/timezone_getCanonicalID_variant1_2.phpt
Normal file
26
ext/intl/tests/timezone_getCanonicalID_variant1_2.phpt
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
--TEST--
|
||||||
|
IntlTimeZone::getCanonicalID(): second argument
|
||||||
|
--SKIPIF--
|
||||||
|
<?php if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?>
|
||||||
|
<?php if (version_compare(INTL_ICU_VERSION, '53.1') < 0) die('skip for ICU >= 53.1'); ?>
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
ini_set("intl.error_level", E_WARNING);
|
||||||
|
|
||||||
|
var_dump(IntlTimeZone::getCanonicalID('Portugal', $isSystemId));
|
||||||
|
var_dump($isSystemId);
|
||||||
|
|
||||||
|
/* A valid custom time zone ID has the following syntax: GMT[+|-]hh[[:]mm] */
|
||||||
|
var_dump(IntlTimeZone::getCanonicalID('GMT +01:25', $isSystemId));
|
||||||
|
var_dump($isSystemId);
|
||||||
|
|
||||||
|
?>
|
||||||
|
==DONE==
|
||||||
|
--EXPECTF--
|
||||||
|
string(13) "Europe/Lisbon"
|
||||||
|
bool(true)
|
||||||
|
|
||||||
|
Warning: IntlTimeZone::getCanonicalID(): intltz_get_canonical_id: error obtaining canonical ID in %stimezone_getCanonicalID_variant1_2.php on line %d
|
||||||
|
bool(false)
|
||||||
|
bool(true)
|
||||||
|
==DONE==
|
Loading…
Add table
Add a link
Reference in a new issue