Exemplo n.º 1
0
 /**
  * Checks if this region contains a culture.
  * 
  * Useful to check if a language is spoken in a region.
  * @param mixed $culture <CultureInfo> or culture code
  * @return bool true or false
  */
 function ContainsCulture($culture)
 {
     if ($culture instanceof CultureInfo) {
         $culture = $culture->Code;
     }
     foreach ($this->KnownCultures as $kc) {
         if (strtolower($kc) == strtolower($culture)) {
             return true;
         }
         $ci = internal_getCultureInfo($kc);
         if ($ci->IsParentOf($culture) || $ci->IsChildOf($culture)) {
             return true;
         }
     }
     return false;
 }
Exemplo n.º 2
0
/**
 * @internal 
 */
function internal_getLanguage($code)
{
    switch (strtolower($code)) {
        case 'ar':
            return new CultureInfo('ar', '', 'ar', 'Arabic', 'العربية', '1');
        case 'bg':
            return new CultureInfo('bg', '', 'bg', 'Bulgarian', 'Български', '0');
        case 'ca':
            return new CultureInfo('ca', '', 'ca', 'Catalan', 'Català', '0');
        case 'zh-cht':
            return new CultureInfo('zh-CHT', 'zh-Hant', 'zh', 'Chinese (Traditional)', '中文(繁體)', '0');
        case 'cs':
            return new CultureInfo('cs', '', 'cs', 'Czech', 'Čeština', '0');
        case 'da':
            return new CultureInfo('da', '', 'da', 'Danish', 'Dansk', '0');
        case 'de':
            return new CultureInfo('de', '', 'de', 'German', 'Deutsch', '0');
        case 'el':
            return new CultureInfo('el', '', 'el', 'Greek', 'Ελληνικά', '0');
        case 'en':
            return new CultureInfo('en', '', 'en', 'English', 'English', '0');
        case 'fi':
            return new CultureInfo('fi', '', 'fi', 'Finnish', 'Suomi', '0');
        case 'fr':
            return new CultureInfo('fr', '', 'fr', 'French', 'Français', '0');
        case 'he':
            return new CultureInfo('he', '', 'he', 'Hebrew', 'עברית', '1');
        case 'hu':
            return new CultureInfo('hu', '', 'hu', 'Hungarian', 'Magyar', '0');
        case 'is':
            return new CultureInfo('is', '', 'is', 'Icelandic', 'Íslenska', '0');
        case 'it':
            return new CultureInfo('it', '', 'it', 'Italian', 'Italiano', '0');
        case 'ja':
            return new CultureInfo('ja', '', 'ja', 'Japanese', '日本語', '0');
        case 'ko':
            return new CultureInfo('ko', '', 'ko', 'Korean', '한국어', '0');
        case 'nl':
            return new CultureInfo('nl', '', 'nl', 'Dutch', 'Nederlands', '0');
        case 'no':
            return new CultureInfo('no', '', 'no', 'Norwegian', 'Norsk', '0');
        case 'pl':
            return new CultureInfo('pl', '', 'pl', 'Polish', 'Polski', '0');
        case 'pt':
            return new CultureInfo('pt', '', 'pt', 'Portuguese', 'Português', '0');
        case 'ro':
            return new CultureInfo('ro', '', 'ro', 'Romanian', 'Română', '0');
        case 'ru':
            return new CultureInfo('ru', '', 'ru', 'Russian', 'Русский', '0');
        case 'hr':
            return new CultureInfo('hr', '', 'hr', 'Croatian', 'Hrvatski', '0');
        case 'sk':
            return new CultureInfo('sk', '', 'sk', 'Slovak', 'Slovenčina', '0');
        case 'sq':
            return new CultureInfo('sq', '', 'sq', 'Albanian', 'Shqipe', '0');
        case 'sv':
            return new CultureInfo('sv', '', 'sv', 'Swedish', 'Svenska', '0');
        case 'th':
            return new CultureInfo('th', '', 'th', 'Thai', 'ไทย', '0');
        case 'tr':
            return new CultureInfo('tr', '', 'tr', 'Turkish', 'Türkçe', '0');
        case 'ur':
            return new CultureInfo('ur', '', 'ur', 'Urdu', 'اُردو', '1');
        case 'id':
            return new CultureInfo('id', '', 'id', 'Indonesian', 'Bahasa Indonesia', '0');
        case 'uk':
            return new CultureInfo('uk', '', 'uk', 'Ukrainian', 'Україньска', '0');
        case 'be':
            return new CultureInfo('be', '', 'be', 'Belarusian', 'Беларускі', '0');
        case 'sl':
            return new CultureInfo('sl', '', 'sl', 'Slovenian', 'Slovenski', '0');
        case 'et':
            return new CultureInfo('et', '', 'et', 'Estonian', 'Eesti', '0');
        case 'lv':
            return new CultureInfo('lv', '', 'lv', 'Latvian', 'Latviešu', '0');
        case 'lt':
            return new CultureInfo('lt', '', 'lt', 'Lithuanian', 'Lietuvių', '0');
        case 'fa':
            return new CultureInfo('fa', '', 'fa', 'Persian', 'فارسى', '1');
        case 'vi':
            return new CultureInfo('vi', '', 'vi', 'Vietnamese', 'Tiếng Việt', '0');
        case 'hy':
            return new CultureInfo('hy', '', 'hy', 'Armenian', 'Հայերեն', '0');
        case 'az':
            return new CultureInfo('az', '', 'az', 'Azeri', 'Azərbaycan­ılı', '0');
        case 'eu':
            return new CultureInfo('eu', '', 'eu', 'Basque', 'Euskara', '0');
        case 'mk':
            return new CultureInfo('mk', '', 'mk', 'Macedonian', 'Македонски јазик', '0');
        case 'af':
            return new CultureInfo('af', '', 'af', 'Afrikaans', 'Afrikaans', '0');
        case 'ka':
            return new CultureInfo('ka', '', 'ka', 'Georgian', 'ქართული', '0');
        case 'fo':
            return new CultureInfo('fo', '', 'fo', 'Faroese', 'Føroyskt', '0');
        case 'hi':
            return new CultureInfo('hi', '', 'hi', 'Hindi', 'हिंदी', '0');
        case 'ms':
            return new CultureInfo('ms', '', 'ms', 'Malay', 'Bahasa Malaysia', '0');
        case 'kk':
            return new CultureInfo('kk', '', 'kk', 'Kazakh', 'Қазащb', '0');
        case 'ky':
            return new CultureInfo('ky', '', 'ky', 'Kyrgyz', 'Кыргыз', '0');
        case 'sw':
            return new CultureInfo('sw', '', 'sw', 'Kiswahili', 'Kiswahili', '0');
        case 'uz':
            return new CultureInfo('uz', '', 'uz', 'Uzbek', 'U\'zbek', '0');
        case 'tt':
            return new CultureInfo('tt', '', 'tt', 'Tatar', 'Татар', '0');
        case 'pa':
            return new CultureInfo('pa', '', 'pa', 'Punjabi', 'ਪੰਜਾਬੀ', '0');
        case 'gu':
            return new CultureInfo('gu', '', 'gu', 'Gujarati', 'ગુજરાતી', '0');
        case 'ta':
            return new CultureInfo('ta', '', 'ta', 'Tamil', 'தமிழ்', '0');
        case 'te':
            return new CultureInfo('te', '', 'te', 'Telugu', 'తెలుగు', '0');
        case 'kn':
            return new CultureInfo('kn', '', 'kn', 'Kannada', 'ಕನ್ನಡ', '0');
        case 'mr':
            return new CultureInfo('mr', '', 'mr', 'Marathi', 'मराठी', '0');
        case 'sa':
            return new CultureInfo('sa', '', 'sa', 'Sanskrit', 'संस्कृत', '0');
        case 'mn':
            return new CultureInfo('mn', '', 'mn', 'Mongolian', 'Монгол хэл', '0');
        case 'gl':
            return new CultureInfo('gl', '', 'gl', 'Galician', 'Galego', '0');
        case 'kok':
            return new CultureInfo('kok', '', 'kok', 'Konkani', 'कोंकणी', '0');
        case 'syr':
            return new CultureInfo('syr', '', 'syr', 'Syriac', 'ܣܘܪܝܝܐ', '1');
        case 'dv':
            return new CultureInfo('dv', '', 'dv', 'Divehi', 'ދިވެހިބަސް', '1');
        case 'zh-chs':
            return new CultureInfo('zh-CHS', 'zh-Hans', 'zh', 'Chinese (Simplified)', '中文(简体)', '0');
        case 'es':
            return new CultureInfo('es', '', 'es', 'Spanish', 'Español', '0');
        case 'sr':
            return new CultureInfo('sr', '', 'sr', 'Serbian', 'Srpski', '0');
        case 'am-et':
            return internal_getCultureInfo('am-ET');
        case 'tzm-latn-dz':
            return internal_getCultureInfo('tzm-Latn-DZ');
        case 'iu-latn-ca':
            return internal_getCultureInfo('iu-Latn-CA');
        case 'sma-no':
            return internal_getCultureInfo('sma-NO');
        case 'mn-mong-cn':
            return internal_getCultureInfo('mn-Mong-CN');
        case 'gd-gb':
            return internal_getCultureInfo('gd-GB');
        case 'prs-af':
            return internal_getCultureInfo('prs-AF');
        case 'bn-bd':
            return internal_getCultureInfo('bn-BD');
        case 'wo-sn':
            return internal_getCultureInfo('wo-SN');
        case 'rw-rw':
            return internal_getCultureInfo('rw-RW');
        case 'qut-gt':
            return internal_getCultureInfo('qut-GT');
        case 'sah-ru':
            return internal_getCultureInfo('sah-RU');
        case 'gsw-fr':
            return internal_getCultureInfo('gsw-FR');
        case 'co-fr':
            return internal_getCultureInfo('co-FR');
        case 'oc-fr':
            return internal_getCultureInfo('oc-FR');
        case 'mi-nz':
            return internal_getCultureInfo('mi-NZ');
        case 'ga-ie':
            return internal_getCultureInfo('ga-IE');
        case 'se-se':
            return internal_getCultureInfo('se-SE');
        case 'br-fr':
            return internal_getCultureInfo('br-FR');
        case 'smn-fi':
            return internal_getCultureInfo('smn-FI');
        case 'moh-ca':
            return internal_getCultureInfo('moh-CA');
        case 'arn-cl':
            return internal_getCultureInfo('arn-CL');
        case 'ii-cn':
            return internal_getCultureInfo('ii-CN');
        case 'dsb-de':
            return internal_getCultureInfo('dsb-DE');
        case 'ig-ng':
            return internal_getCultureInfo('ig-NG');
        case 'kl-gl':
            return internal_getCultureInfo('kl-GL');
        case 'lb-lu':
            return internal_getCultureInfo('lb-LU');
        case 'ba-ru':
            return internal_getCultureInfo('ba-RU');
        case 'nso-za':
            return internal_getCultureInfo('nso-ZA');
        case 'quz-bo':
            return internal_getCultureInfo('quz-BO');
        case 'yo-ng':
            return internal_getCultureInfo('yo-NG');
        case 'ha-latn-ng':
            return internal_getCultureInfo('ha-Latn-NG');
        case 'fil-ph':
            return internal_getCultureInfo('fil-PH');
        case 'ps-af':
            return internal_getCultureInfo('ps-AF');
        case 'fy-nl':
            return internal_getCultureInfo('fy-NL');
        case 'ne-np':
            return internal_getCultureInfo('ne-NP');
        case 'se-no':
            return internal_getCultureInfo('se-NO');
        case 'iu-cans-ca':
            return internal_getCultureInfo('iu-Cans-CA');
        case 'sr-latn-rs':
            return internal_getCultureInfo('sr-Latn-RS');
        case 'si-lk':
            return internal_getCultureInfo('si-LK');
        case 'sr-cyrl-rs':
            return internal_getCultureInfo('sr-Cyrl-RS');
        case 'lo-la':
            return internal_getCultureInfo('lo-LA');
        case 'km-kh':
            return internal_getCultureInfo('km-KH');
        case 'cy-gb':
            return internal_getCultureInfo('cy-GB');
        case 'bo-cn':
            return internal_getCultureInfo('bo-CN');
        case 'sms-fi':
            return internal_getCultureInfo('sms-FI');
        case 'as-in':
            return internal_getCultureInfo('as-IN');
        case 'ml-in':
            return internal_getCultureInfo('ml-IN');
        case 'or-in':
            return internal_getCultureInfo('or-IN');
        case 'bn-in':
            return internal_getCultureInfo('bn-IN');
        case 'tk-tm':
            return internal_getCultureInfo('tk-TM');
        case 'bs-latn-ba':
            return internal_getCultureInfo('bs-Latn-BA');
        case 'mt-mt':
            return internal_getCultureInfo('mt-MT');
        case 'sr-cyrl-me':
            return internal_getCultureInfo('sr-Cyrl-ME');
        case 'se-fi':
            return internal_getCultureInfo('se-FI');
        case 'zu-za':
            return internal_getCultureInfo('zu-ZA');
        case 'xh-za':
            return internal_getCultureInfo('xh-ZA');
        case 'tn-za':
            return internal_getCultureInfo('tn-ZA');
        case 'hsb-de':
            return internal_getCultureInfo('hsb-DE');
        case 'bs-cyrl-ba':
            return internal_getCultureInfo('bs-Cyrl-BA');
        case 'tg-cyrl-tj':
            return internal_getCultureInfo('tg-Cyrl-TJ');
        case 'sr-latn-ba':
            return internal_getCultureInfo('sr-Latn-BA');
        case 'smj-no':
            return internal_getCultureInfo('smj-NO');
        case 'rm-ch':
            return internal_getCultureInfo('rm-CH');
        case 'smj-se':
            return internal_getCultureInfo('smj-SE');
        case 'quz-ec':
            return internal_getCultureInfo('quz-EC');
        case 'quz-pe':
            return internal_getCultureInfo('quz-PE');
        case 'sr-latn-me':
            return internal_getCultureInfo('sr-Latn-ME');
        case 'sma-se':
            return internal_getCultureInfo('sma-SE');
        case 'ug-cn':
            return internal_getCultureInfo('ug-CN');
        case 'sr-cyrl-ba':
            return internal_getCultureInfo('sr-Cyrl-BA');
    }
}