1--TEST--
2locale_get_keywords() icu <= 4.2
3--SKIPIF--
4<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
5<?php if(version_compare(INTL_ICU_VERSION, '4.3', '<') != 1) 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: No keywords found.
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: No keywords found.
128az-Arab-x-AZE-derbend: No keywords found.
129zh-min: No keywords found.
130zh-min-nan-Hant-CN: No keywords found.
131x-whatever: No keywords found.
132qaa-Qaaa-QM-x-southern: No keywords found.
133sr-Latn-QM: No keywords found.
134sr-Qaaa-CS: No keywords found.
135en-US-u-islamCal: No keywords found.
136zh-CN-a-myExt-x-private: No keywords found.
137en-a-myExt-b-another: No keywords found.
138de-419-DE: No keywords found.
139a-DE: No keywords found.
140ar-a-aaa-b-bbb-a-ccc: No keywords found.
141