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