Annotation of embedaddon/php/ext/intl/tests/locale_get_keywords2.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: locale_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: 
        !            14: function 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: 
        !            97: include_once( 'ut_common.inc' );
        !            98: ut_run();
        !            99: 
        !           100: ?>
        !           101: --EXPECT--
        !           102: de_DE@currency=EUR;collation=PHONEBOOK: Key is collation and Value is PHONEBOOK 
        !           103: Key is currency and Value is EUR 
        !           104: 
        !           105: root: No keywords found.
        !           106: uk@currency=EURO: Key is currency and Value is EURO 
        !           107: 
        !           108: Hindi: No keywords found.
        !           109: de: No keywords found.
        !           110: fr: No keywords found.
        !           111: ja: No keywords found.
        !           112: i-enochian: Key is x and Value is i-enochian 
        !           113: 
        !           114: zh-Hant: No keywords found.
        !           115: zh-Hans: No keywords found.
        !           116: sr-Cyrl: No keywords found.
        !           117: sr-Latn: No keywords found.
        !           118: zh-Hans-CN: No keywords found.
        !           119: sr-Latn-CS: No keywords found.
        !           120: sl-rozaj: No keywords found.
        !           121: sl-nedis: No keywords found.
        !           122: de-CH-1901: No keywords found.
        !           123: sl-IT-nedis: No keywords found.
        !           124: sl-Latn-IT-nedis: No keywords found.
        !           125: de-DE: No keywords found.
        !           126: en-US: No keywords found.
        !           127: es-419: No keywords found.
        !           128: de-CH-x-phonebk: Key is x and Value is phonebk 
        !           129: 
        !           130: az-Arab-x-AZE-derbend: Key is x and Value is aze-derbend 
        !           131: 
        !           132: zh-min: No keywords found.
        !           133: zh-min-nan-Hant-CN: No keywords found.
        !           134: x-whatever: Key is x and Value is whatever 
        !           135: 
        !           136: qaa-Qaaa-QM-x-southern: Key is x and Value is southern 
        !           137: 
        !           138: sr-Latn-QM: No keywords found.
        !           139: sr-Qaaa-CS: No keywords found.
        !           140: en-US-u-islamCal: Key is attribute and Value is islamcal 
        !           141: 
        !           142: zh-CN-a-myExt-x-private: Key is a and Value is myext 
        !           143: Key is x and Value is private 
        !           144: 
        !           145: en-a-myExt-b-another: Key is a and Value is myext 
        !           146: Key is b and Value is another 
        !           147: 
        !           148: de-419-DE: No keywords found.
        !           149: a-DE: No keywords found.
        !           150: ar-a-aaa-b-bbb-a-ccc: Key is a and Value is aaa 
        !           151: Key is b and Value is bbb

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>