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