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