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