1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
|
--TEST--
locale_get_keywords() icu <= 4.2
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
<?php if(version_compare(INTL_ICU_VERSION, '4.3', '<') != 1) print 'skip'; ?>
--FILE--
<?php
/*
* Try getting the keywords for different locales
* with Procedural and Object methods.
*/
function ut_main()
{
$res_str = '';
$locales = array(
"de_DE@currency=EUR;collation=PHONEBOOK",
'uk-ua_CALIFORNIA@currency=GRN'
);
$locales = array(
'de_DE@currency=EUR;collation=PHONEBOOK',
'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 )
{
$keywords_arr = ut_loc_get_keywords( $locale);
$res_str .= "$locale: ";
if( $keywords_arr){
foreach( $keywords_arr as $key => $value){
$res_str .= "Key is $key and Value is $value \n";
}
}
else{
$res_str .= "No keywords found.";
}
$res_str .= "\n";
}
$res_str .= "\n";
return $res_str;
}
include_once( 'ut_common.inc' );
ut_run();
?>
--EXPECT--
de_DE@currency=EUR;collation=PHONEBOOK: Key is collation and Value is PHONEBOOK
Key is currency and Value is EUR
root: No keywords found.
uk@currency=EURO: Key is currency and Value is EURO
Hindi: No keywords found.
de: No keywords found.
fr: No keywords found.
ja: No keywords found.
i-enochian: No keywords found.
zh-Hant: No keywords found.
zh-Hans: No keywords found.
sr-Cyrl: No keywords found.
sr-Latn: No keywords found.
zh-Hans-CN: No keywords found.
sr-Latn-CS: No keywords found.
sl-rozaj: No keywords found.
sl-nedis: No keywords found.
de-CH-1901: No keywords found.
sl-IT-nedis: No keywords found.
sl-Latn-IT-nedis: No keywords found.
de-DE: No keywords found.
en-US: No keywords found.
es-419: No keywords found.
de-CH-x-phonebk: No keywords found.
az-Arab-x-AZE-derbend: No keywords found.
zh-min: No keywords found.
zh-min-nan-Hant-CN: No keywords found.
x-whatever: No keywords found.
qaa-Qaaa-QM-x-southern: No keywords found.
sr-Latn-QM: No keywords found.
sr-Qaaa-CS: No keywords found.
en-US-u-islamCal: No keywords found.
zh-CN-a-myExt-x-private: No keywords found.
en-a-myExt-b-another: No keywords found.
de-419-DE: No keywords found.
a-DE: No keywords found.
ar-a-aaa-b-bbb-a-ccc: No keywords found.
|