Annotation of embedaddon/php/ext/intl/tests/locale_get_primary_language.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: locale_get_primary_language()
! 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:
! 13: function 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: '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:
! 69: $res_str = '';
! 70:
! 71: foreach( $locales as $locale )
! 72: {
! 73: $lang = ut_loc_get_primary_language( $locale);
! 74: $res_str .= "$locale: primary_language='$lang'";
! 75: $res_str .= "\n";
! 76: }
! 77:
! 78: return $res_str;
! 79:
! 80: }
! 81:
! 82: include_once( 'ut_common.inc' );
! 83: ut_run();
! 84:
! 85: ?>
! 86: --EXPECT--
! 87: uk-ua_CALIFORNIA@currency=;currency=GRN: primary_language='uk'
! 88: root: primary_language='root'
! 89: uk@currency=EURO: primary_language='uk'
! 90: Hindi: primary_language='hindi'
! 91: de: primary_language='de'
! 92: fr: primary_language='fr'
! 93: ja: primary_language='ja'
! 94: i-enochian: primary_language='i-enochian'
! 95: zh-Hant: primary_language='zh'
! 96: zh-Hans: primary_language='zh'
! 97: sr-Cyrl: primary_language='sr'
! 98: sr-Latn: primary_language='sr'
! 99: zh-Hans-CN: primary_language='zh'
! 100: sr-Latn-CS: primary_language='sr'
! 101: sl-rozaj: primary_language='sl'
! 102: sl-nedis: primary_language='sl'
! 103: de-CH-1901: primary_language='de'
! 104: sl-IT-nedis: primary_language='sl'
! 105: sl-Latn-IT-nedis: primary_language='sl'
! 106: de-DE: primary_language='de'
! 107: en-US: primary_language='en'
! 108: es-419: primary_language='es'
! 109: de-CH-x-phonebk: primary_language='de'
! 110: az-Arab-x-AZE-derbend: primary_language='az'
! 111: zh-min: primary_language='zh-min'
! 112: zh-min-nan-Hant-CN: primary_language='zh'
! 113: qaa-Qaaa-QM-x-southern: primary_language='qaa'
! 114: sr-Latn-QM: primary_language='sr'
! 115: sr-Qaaa-CS: primary_language='sr'
! 116: en-US-u-islamCal: primary_language='en'
! 117: zh-CN-a-myExt-x-private: primary_language='zh'
! 118: en-a-myExt-b-another: primary_language='en'
! 119: de-419-DE: primary_language='de'
! 120: a-DE: primary_language='a'
! 121: ar-a-aaa-b-bbb-a-ccc: primary_language='ar'
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>