mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
ENHANCEMENT Added Translatable::get_locale_from_lang(), Translatable::get_common_locales(), $common_locales and $likely_subtags in preparation to switch Translatable from using short "lang" codes to proper long locales
API CHANGE Deprecated Translatable::set_default_lang(), Translatable::default_lang() git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@73466 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
25b19f0ae4
commit
c14b71dfc0
617
core/i18n.php
617
core/i18n.php
@ -575,8 +575,8 @@ class i18n extends Object {
|
||||
);
|
||||
|
||||
/**
|
||||
* A list of commonly used languages, in the form
|
||||
* langcode => array( EnglishName, NativeName)
|
||||
* @var array $common_languages A list of commonly used languages, in the form
|
||||
* langcode => array( EnglishName, NativeName)
|
||||
*/
|
||||
public static $common_languages = array(
|
||||
'af' => array('Afrikaans', 'Afrikaans'),
|
||||
@ -666,6 +666,99 @@ class i18n extends Object {
|
||||
'zu' => array('Zulu', 'isiZulu')
|
||||
);
|
||||
|
||||
/**
|
||||
* @var array $common_locales
|
||||
* Sorted alphabtically by the common language name,
|
||||
* not the locale key.
|
||||
*/
|
||||
public static $common_locales = array(
|
||||
'af_ZA' => array('Afrikaans', 'Afrikaans'),
|
||||
'sq_AL' => array('Albanian', 'shqip'),
|
||||
'ar_EG' => array('Arabic', 'العربية'),
|
||||
'eu_ES' => array('Basque', 'euskera'),
|
||||
'be_BY' => array('Belarusian', 'Беларуская мова'),
|
||||
'bn_BD' => array('Bengali', 'বাংলা'),
|
||||
'bg_BG' => array('Bulgarian', 'български'),
|
||||
'ca_ES' => array('Catalan', 'català'),
|
||||
'zh-yue_ZH-YUE' => array('Chinese (Cantonese)', '廣東話 [广东话]'),
|
||||
'zh-cmn_ZH-CMN' => array('Chinese (Mandarin)', '普通話 [普通话]'),
|
||||
'zh-min-nan_ZH-MIN-NAN' => array('Chinese (Min Nan)', '台語'),
|
||||
'hr_HR' => array('Croatian', 'Hrvatski'),
|
||||
'cs_CZ' => array('Czech', 'čeština'),
|
||||
'cy_GB' => array('Welsh', 'Welsh/Cymraeg'),
|
||||
'da_DK' => array('Danish', 'dansk'),
|
||||
'nl_NL' => array('Dutch', 'Nederlands'),
|
||||
'en_US' => array('English', 'English'),
|
||||
'eo_EO' => array('Esperanto', 'Esperanto'),
|
||||
'et_EE' => array('Estonian', 'eesti keel'),
|
||||
'fo_FO' => array('Faroese', 'Føroyska'),
|
||||
'fi_FI' => array('Finnish', 'suomi'),
|
||||
'fr_FR' => array('French', 'français'),
|
||||
'gd_GB' => array('Gaelic', 'Gaeilge'),
|
||||
'gl_ES' => array('Galician', 'Galego'),
|
||||
'de_DE' => array('German', 'Deutsch'),
|
||||
'el_GR' => array('Greek', 'ελληνικά'),
|
||||
'gu_IN' => array('Gujarati', 'ગુજરાતી'),
|
||||
'ha_NG' => array('Hausa', 'حَوْسَ'),
|
||||
'he_IL' => array('Hebrew', 'עברית'),
|
||||
'hi_IN' => array('Hindi', 'हिन्दी'),
|
||||
'hu_HU' => array('Hungarian', 'magyar'),
|
||||
'is_IS' => array('Icelandic', 'Íslenska'),
|
||||
'io_IO' => array('Ido', 'Ido'),
|
||||
'id_ID' => array('Indonesian', 'Bahasa Indonesia'),
|
||||
'ga_IE' => array('Irish', 'Irish'),
|
||||
'it_IT' => array('Italian', 'italiano'),
|
||||
'ja_JP' => array('Japanese', '日本語'),
|
||||
'jv_ID' => array('Javanese', 'basa Jawa'),
|
||||
'ko_KR' => array('Korean', '한국어 [韓國語]'),
|
||||
'ku_IQ' => array('Kurdish', 'Kurdí'),
|
||||
'lv_LV' => array('Latvian', 'latviešu'),
|
||||
'lt_LT' => array('Lithuanian', 'lietuviškai'),
|
||||
'lmo_LMO' => array('Lombard', 'Lombardo'),
|
||||
'mk_MK' => array('Macedonian', 'македонски'),
|
||||
'mi_NZ' => array('Maori', 'Maori'),
|
||||
'ms_MY' => array('Malay', 'Bahasa melayu'),
|
||||
'mt_MT' => array('Maltese', 'Malti'),
|
||||
'mr_IN' => array('Marathi', 'मराठी'),
|
||||
'ne_NP' => array('Nepali', 'नेपाली'),
|
||||
'no_NO' => array('Norwegian', 'Norsk'),
|
||||
'om_ET' => array('Oromo', 'Afaan Oromo'),
|
||||
'fa_IR' => array('Persian', 'فارسى'),
|
||||
'pl_PL' => array('Polish', 'polski'),
|
||||
'pt-PT_PT-PT' => array('Portuguese (Portugal)', 'português (Portugal)'),
|
||||
'pt-BR_PT-BR' => array('Portuguese (Brazil)', 'português (Brazil)'),
|
||||
'pa_IN' => array('Punjabi', 'ਪੰਜਾਬੀ'),
|
||||
'qu_PE' => array('Quechua', 'Quechua'),
|
||||
'rm_CH' => array('Romansh', 'rumantsch'),
|
||||
'ro_RO' => array('Romanian', 'român'),
|
||||
'ru_RU' => array('Russian', 'Русский'),
|
||||
'sco_SCO' => array('Scots', 'Scoats leid, Lallans'),
|
||||
'sr_RS' => array('Serbian', 'српски'),
|
||||
'sk_SK' => array('Slovak', 'slovenčina'),
|
||||
'sl_SI' => array('Slovenian', 'slovenščina'),
|
||||
'es_ES' => array('Spanish', 'español'),
|
||||
'sv_SE' => array('Swedish', 'Svenska'),
|
||||
'tl_PH' => array('Tagalog', 'Tagalog'),
|
||||
'ta_IN' => array('Tamil', 'தமிழ்'),
|
||||
'te_IN' => array('Telugu', 'తెలుగు'),
|
||||
'to_TO' => array('Tonga', 'chiTonga'),
|
||||
'ts_ZA' => array('Tsonga', 'xiTshonga'),
|
||||
'tn_ZA' => array('Tswana', 'seTswana'),
|
||||
'tr_TR' => array('Turkish', 'Türkçe'),
|
||||
'tk_TM' => array('Turkmen', 'түркmенче'),
|
||||
'tw_GH' => array('Twi', 'twi'),
|
||||
'uk_UA' => array('Ukrainian', 'Українська'),
|
||||
'ur_PK' => array('Urdu', 'اردو'),
|
||||
'uz_UZ' => array('Uzbek', 'ўзбек'),
|
||||
've_ZA' => array('Venda', 'tshiVenḓa'),
|
||||
'vi_VN' => array('Vietnamese', 'tiếng việt'),
|
||||
'wa_WA' => array('Walloon', 'walon'),
|
||||
'wo_SN' => array('Wolof', 'Wollof'),
|
||||
'xh_ZA' => array('Xhosa', 'isiXhosa'),
|
||||
'yi_YI' => array('Yiddish', 'ײִדיש'),
|
||||
'zu_ZA' => array('Zulu', 'isiZulu'),
|
||||
);
|
||||
|
||||
static $tinymce_lang = array(
|
||||
'ca_AD' => 'ca',
|
||||
'ca_ES' => 'ca',
|
||||
@ -828,6 +921,473 @@ class i18n extends Object {
|
||||
|
||||
);
|
||||
|
||||
/**
|
||||
* @var array $likely_subtags Provides you "likely locales"
|
||||
* for a given "short" language code. This is a guess,
|
||||
* as we can't disambiguate from e.g. "en" to "en_US" - it
|
||||
* could also mean "en_UK".
|
||||
* @see http://www.unicode.org/cldr/data/charts/supplemental/likely_subtags.html
|
||||
*/
|
||||
static $likely_subtags = array(
|
||||
'aa' => 'aa_ET',
|
||||
'ab' => 'ab_GE',
|
||||
'ady' => 'ady_RU',
|
||||
'af' => 'af_ZA',
|
||||
'ak' => 'ak_GH',
|
||||
'am' => 'am_ET',
|
||||
'ar' => 'ar_EG',
|
||||
'as' => 'as_IN',
|
||||
'ast' => 'ast_ES',
|
||||
'av' => 'av_RU',
|
||||
'ay' => 'ay_BO',
|
||||
'az' => 'az_AZ',
|
||||
'az_Cyrl' => 'az_AZ',
|
||||
'az_Arab' => 'az_IR',
|
||||
'az_IR' => 'az_IR',
|
||||
'ba' => 'ba_RU',
|
||||
'be' => 'be_BY',
|
||||
'bg' => 'bg_BG',
|
||||
'bi' => 'bi_VU',
|
||||
'bn' => 'bn_BD',
|
||||
'bo' => 'bo_CN',
|
||||
'bs' => 'bs_BA',
|
||||
'ca' => 'ca_ES',
|
||||
'ce' => 'ce_RU',
|
||||
'ceb' => 'ceb_PH',
|
||||
'ch' => 'ch_GU',
|
||||
'chk' => 'chk_FM',
|
||||
'crk' => 'crk_CA',
|
||||
'cs' => 'cs_CZ',
|
||||
'cwd' => 'cwd_CA',
|
||||
'cy' => 'cy_GB',
|
||||
'da' => 'da_DK',
|
||||
'de' => 'de_DE',
|
||||
'dv' => 'dv_MV',
|
||||
'dz' => 'dz_BT',
|
||||
'ee' => 'ee_GH',
|
||||
'efi' => 'efi_NG',
|
||||
'el' => 'el_GR',
|
||||
'en' => 'en_US',
|
||||
'es' => 'es_ES',
|
||||
'et' => 'et_EE',
|
||||
'eu' => 'eu_ES',
|
||||
'fa' => 'fa_IR',
|
||||
'fi' => 'fi_FI',
|
||||
'fil' => 'fil_PH',
|
||||
'fj' => 'fj_FJ',
|
||||
'fo' => 'fo_FO',
|
||||
'fr' => 'fr_FR',
|
||||
'fur' => 'fur_IT',
|
||||
'fy' => 'fy_NL',
|
||||
'ga' => 'ga_IE',
|
||||
'gaa' => 'gaa_GH',
|
||||
'gd' => 'gd_GB',
|
||||
'gil' => 'gil_KI',
|
||||
'gl' => 'gl_ES',
|
||||
'gn' => 'gn_PY',
|
||||
'gu' => 'gu_IN',
|
||||
'ha' => 'ha_NG',
|
||||
'ha_Arab' => 'ha_SD',
|
||||
'ha_SD' => 'ha_SD',
|
||||
'haw' => 'haw_US',
|
||||
'he' => 'he_IL',
|
||||
'hi' => 'hi_IN',
|
||||
'hil' => 'hil_PH',
|
||||
'ho' => 'ho_PG',
|
||||
'hr' => 'hr_HR',
|
||||
'ht' => 'ht_HT',
|
||||
'hu' => 'hu_HU',
|
||||
'hy' => 'hy_AM',
|
||||
'id' => 'id_ID',
|
||||
'ig' => 'ig_NG',
|
||||
'ii' => 'ii_CN',
|
||||
'ilo' => 'ilo_PH',
|
||||
'inh' => 'inh_RU',
|
||||
'is' => 'is_IS',
|
||||
'it' => 'it_IT',
|
||||
'iu' => 'iu_CA',
|
||||
'ja' => 'ja_JP',
|
||||
'jv' => 'jv_ID',
|
||||
'ka' => 'ka_GE',
|
||||
'kaj' => 'kaj_NG',
|
||||
'kam' => 'kam_KE',
|
||||
'kbd' => 'kbd_RU',
|
||||
'kha' => 'kha_IN',
|
||||
'kk' => 'kk_KZ',
|
||||
'kl' => 'kl_GL',
|
||||
'km' => 'km_KH',
|
||||
'kn' => 'kn_IN',
|
||||
'ko' => 'ko_KR',
|
||||
'koi' => 'koi_RU',
|
||||
'kok' => 'kok_IN',
|
||||
'kos' => 'kos_FM',
|
||||
'kpe' => 'kpe_LR',
|
||||
'kpv' => 'kpv_RU',
|
||||
'krc' => 'krc_RU',
|
||||
'ks' => 'ks_IN',
|
||||
'ku' => 'ku_IQ',
|
||||
'ku_Latn' => 'ku_TR',
|
||||
'ku_TR' => 'ku_TR',
|
||||
'kum' => 'kum_RU',
|
||||
'ky' => 'ky_KG',
|
||||
'la' => 'la_VA',
|
||||
'lah' => 'lah_PK',
|
||||
'lb' => 'lb_LU',
|
||||
'lbe' => 'lbe_RU',
|
||||
'lez' => 'lez_RU',
|
||||
'ln' => 'ln_CD',
|
||||
'lo' => 'lo_LA',
|
||||
'lt' => 'lt_LT',
|
||||
'lv' => 'lv_LV',
|
||||
'mai' => 'mai_IN',
|
||||
'mdf' => 'mdf_RU',
|
||||
'mdh' => 'mdh_PH',
|
||||
'mg' => 'mg_MG',
|
||||
'mh' => 'mh_MH',
|
||||
'mi' => 'mi_NZ',
|
||||
'mk' => 'mk_MK',
|
||||
'ml' => 'ml_IN',
|
||||
'mn' => 'mn_MN',
|
||||
'mn_CN' => 'mn_CN',
|
||||
'mn_Mong' => 'mn_CN',
|
||||
'mr' => 'mr_IN',
|
||||
'ms' => 'ms_MY',
|
||||
'mt' => 'mt_MT',
|
||||
'my' => 'my_MM',
|
||||
'myv' => 'myv_RU',
|
||||
'na' => 'na_NR',
|
||||
'nb' => 'nb_NO',
|
||||
'ne' => 'ne_NP',
|
||||
'niu' => 'niu_NU',
|
||||
'nl' => 'nl_NL',
|
||||
'nn' => 'nn_NO',
|
||||
'nr' => 'nr_ZA',
|
||||
'nso' => 'nso_ZA',
|
||||
'ny' => 'ny_MW',
|
||||
'om' => 'om_ET',
|
||||
'or' => 'or_IN',
|
||||
'os' => 'os_GE',
|
||||
'pa' => 'pa_IN',
|
||||
'pa_Arab' => 'pa_PK',
|
||||
'pa_PK' => 'pa_PK',
|
||||
'pag' => 'pag_PH',
|
||||
'pap' => 'pap_AN',
|
||||
'pau' => 'pau_PW',
|
||||
'pl' => 'pl_PL',
|
||||
'pon' => 'pon_FM',
|
||||
'ps' => 'ps_AF',
|
||||
'pt' => 'pt_BR',
|
||||
'qu' => 'qu_PE',
|
||||
'rm' => 'rm_CH',
|
||||
'rn' => 'rn_BI',
|
||||
'ro' => 'ro_RO',
|
||||
'ru' => 'ru_RU',
|
||||
'rw' => 'rw_RW',
|
||||
'sa' => 'sa_IN',
|
||||
'sah' => 'sah_RU',
|
||||
'sat' => 'sat_IN',
|
||||
'sd' => 'sd_IN',
|
||||
'se' => 'se_NO',
|
||||
'sg' => 'sg_CF',
|
||||
'si' => 'si_LK',
|
||||
'sid' => 'sid_ET',
|
||||
'sk' => 'sk_SK',
|
||||
'sl' => 'sl_SI',
|
||||
'sm' => 'sm_WS',
|
||||
'sn' => 'sn_ZW',
|
||||
'so' => 'so_SO',
|
||||
'sq' => 'sq_AL',
|
||||
'sr' => 'sr_RS',
|
||||
'ss' => 'ss_ZA',
|
||||
'st' => 'st_ZA',
|
||||
'su' => 'su_ID',
|
||||
'sv' => 'sv_SE',
|
||||
'sw' => 'sw_TZ',
|
||||
'swb' => 'swb_KM',
|
||||
'ta' => 'ta_IN',
|
||||
'te' => 'te_IN',
|
||||
'tet' => 'tet_TL',
|
||||
'tg' => 'tg_TJ',
|
||||
'th' => 'th_TH',
|
||||
'ti' => 'ti_ET',
|
||||
'tig' => 'tig_ER',
|
||||
'tk' => 'tk_TM',
|
||||
'tkl' => 'tkl_TK',
|
||||
'tl' => 'tl_PH',
|
||||
'tn' => 'tn_ZA',
|
||||
'to' => 'to_TO',
|
||||
'tpi' => 'tpi_PG',
|
||||
'tr' => 'tr_TR',
|
||||
'trv' => 'trv_TW',
|
||||
'ts' => 'ts_ZA',
|
||||
'tsg' => 'tsg_PH',
|
||||
'tt' => 'tt_RU',
|
||||
'tts' => 'tts_TH',
|
||||
'tvl' => 'tvl_TV',
|
||||
'tw' => 'tw_GH',
|
||||
'ty' => 'ty_PF',
|
||||
'tyv' => 'tyv_RU',
|
||||
'udm' => 'udm_RU',
|
||||
'ug' => 'ug_CN',
|
||||
'uk' => 'uk_UA',
|
||||
'uli' => 'uli_FM',
|
||||
'und' => 'en_US',
|
||||
'und_AD' => 'ca_AD',
|
||||
'und_AE' => 'ar_AE',
|
||||
'und_AF' => 'fa_AF',
|
||||
'und_AL' => 'sq_AL',
|
||||
'und_AM' => 'hy_AM',
|
||||
'und_AN' => 'pap_AN',
|
||||
'und_AO' => 'pt_AO',
|
||||
'und_AR' => 'es_AR',
|
||||
'und_AS' => 'sm_AS',
|
||||
'und_AT' => 'de_AT',
|
||||
'und_AW' => 'nl_AW',
|
||||
'und_AX' => 'sv_AX',
|
||||
'und_AZ' => 'az_AZ',
|
||||
'und_Arab' => 'ar_EG',
|
||||
'und_Arab_CN' => 'ug_CN',
|
||||
'und_Arab_DJ' => 'ar_DJ',
|
||||
'und_Arab_ER' => 'ar_ER',
|
||||
'und_Arab_IL' => 'ar_IL',
|
||||
'und_Arab_IN' => 'ur_IN',
|
||||
'und_Arab_PK' => 'ur_PK',
|
||||
'und_Armn' => 'hy_AM',
|
||||
'und_BA' => 'bs_BA',
|
||||
'und_BD' => 'bn_BD',
|
||||
'und_BE' => 'nl_BE',
|
||||
'und_BF' => 'fr_BF',
|
||||
'und_BG' => 'bg_BG',
|
||||
'und_BH' => 'ar_BH',
|
||||
'und_BI' => 'rn_BI',
|
||||
'und_BJ' => 'fr_BJ',
|
||||
'und_BL' => 'fr_BL',
|
||||
'und_BN' => 'ms_BN',
|
||||
'und_BO' => 'es_BO',
|
||||
'und_BR' => 'pt_BR',
|
||||
'und_BT' => 'dz_BT',
|
||||
'und_BY' => 'be_BY',
|
||||
'und_Beng' => 'bn_BD',
|
||||
'und_CD' => 'fr_CD',
|
||||
'und_CF' => 'sg_CF',
|
||||
'und_CG' => 'ln_CG',
|
||||
'und_CH' => 'de_CH',
|
||||
'und_CI' => 'fr_CI',
|
||||
'und_CL' => 'es_CL',
|
||||
'und_CM' => 'fr_CM',
|
||||
'und_CN' => 'zh_CN',
|
||||
'und_CO' => 'es_CO',
|
||||
'und_CR' => 'es_CR',
|
||||
'und_CU' => 'es_CU',
|
||||
'und_CV' => 'pt_CV',
|
||||
'und_CY' => 'el_CY',
|
||||
'und_CZ' => 'cs_CZ',
|
||||
'und_Cans' => 'cwd_CA',
|
||||
'und_Cyrl' => 'ru_RU',
|
||||
'und_Cyrl_BA' => 'sr_BA',
|
||||
'und_Cyrl_GE' => 'ab_GE',
|
||||
'und_DE' => 'de_DE',
|
||||
'und_DJ' => 'aa_DJ',
|
||||
'und_DK' => 'da_DK',
|
||||
'und_DO' => 'es_DO',
|
||||
'und_DZ' => 'ar_DZ',
|
||||
'und_Deva' => 'hi_IN',
|
||||
'und_EC' => 'es_EC',
|
||||
'und_EE' => 'et_EE',
|
||||
'und_EG' => 'ar_EG',
|
||||
'und_EH' => 'ar_EH',
|
||||
'und_ER' => 'ti_ER',
|
||||
'und_ES' => 'es_ES',
|
||||
'und_ET' => 'am_ET',
|
||||
'und_Ethi' => 'am_ET',
|
||||
'und_FI' => 'fi_FI',
|
||||
'und_FJ' => 'fj_FJ',
|
||||
'und_FM' => 'chk_FM',
|
||||
'und_FO' => 'fo_FO',
|
||||
'und_FR' => 'fr_FR',
|
||||
'und_GA' => 'fr_GA',
|
||||
'und_GE' => 'ka_GE',
|
||||
'und_GF' => 'fr_GF',
|
||||
'und_GH' => 'ak_GH',
|
||||
'und_GL' => 'kl_GL',
|
||||
'und_GN' => 'fr_GN',
|
||||
'und_GP' => 'fr_GP',
|
||||
'und_GQ' => 'fr_GQ',
|
||||
'und_GR' => 'el_GR',
|
||||
'und_GT' => 'es_GT',
|
||||
'und_GU' => 'ch_GU',
|
||||
'und_GW' => 'pt_GW',
|
||||
'und_Geor' => 'ka_GE',
|
||||
'und_Grek' => 'el_GR',
|
||||
'und_Gujr' => 'gu_IN',
|
||||
'und_Guru' => 'pa_IN',
|
||||
'und_HK' => 'zh_HK',
|
||||
'und_HN' => 'es_HN',
|
||||
'und_HR' => 'hr_HR',
|
||||
'und_HT' => 'ht_HT',
|
||||
'und_HU' => 'hu_HU',
|
||||
'und_Hani' => 'zh_CN',
|
||||
'und_Hans' => 'zh_CN',
|
||||
'und_Hant' => 'zh_TW',
|
||||
'und_Hebr' => 'he_IL',
|
||||
'und_ID' => 'id_ID',
|
||||
'und_IL' => 'he_IL',
|
||||
'und_IN' => 'hi_IN',
|
||||
'und_IQ' => 'ar_IQ',
|
||||
'und_IR' => 'fa_IR',
|
||||
'und_IS' => 'is_IS',
|
||||
'und_IT' => 'it_IT',
|
||||
'und_JO' => 'ar_JO',
|
||||
'und_JP' => 'ja_JP',
|
||||
'und_Jpan' => 'ja_JP',
|
||||
'und_KG' => 'ky_KG',
|
||||
'und_KH' => 'km_KH',
|
||||
'und_KM' => 'ar_KM',
|
||||
'und_KP' => 'ko_KP',
|
||||
'und_KR' => 'ko_KR',
|
||||
'und_KW' => 'ar_KW',
|
||||
'und_KZ' => 'ru_KZ',
|
||||
'und_Khmr' => 'km_KH',
|
||||
'und_Knda' => 'kn_IN',
|
||||
'und_Kore' => 'ko_KR',
|
||||
'und_LA' => 'lo_LA',
|
||||
'und_LB' => 'ar_LB',
|
||||
'und_LI' => 'de_LI',
|
||||
'und_LK' => 'si_LK',
|
||||
'und_LS' => 'st_LS',
|
||||
'und_LT' => 'lt_LT',
|
||||
'und_LU' => 'fr_LU',
|
||||
'und_LV' => 'lv_LV',
|
||||
'und_LY' => 'ar_LY',
|
||||
'und_Laoo' => 'lo_LA',
|
||||
'und_Latn_CN' => 'ii_CN',
|
||||
'und_Latn_CY' => 'tr_CY',
|
||||
'und_Latn_DZ' => 'fr_DZ',
|
||||
'und_Latn_ET' => 'om_ET',
|
||||
'und_Latn_KM' => 'fr_KM',
|
||||
'und_Latn_MA' => 'fr_MA',
|
||||
'und_Latn_MK' => 'sq_MK',
|
||||
'und_Latn_SY' => 'fr_SY',
|
||||
'und_Latn_TD' => 'fr_TD',
|
||||
'und_Latn_TN' => 'fr_TN',
|
||||
'und_MA' => 'ar_MA',
|
||||
'und_MC' => 'fr_MC',
|
||||
'und_MD' => 'ro_MD',
|
||||
'und_ME' => 'sr_ME',
|
||||
'und_MF' => 'fr_MF',
|
||||
'und_MG' => 'mg_MG',
|
||||
'und_MH' => 'mh_MH',
|
||||
'und_MK' => 'mk_MK',
|
||||
'und_ML' => 'fr_ML',
|
||||
'und_MM' => 'my_MM',
|
||||
'und_MN' => 'mn_MN',
|
||||
'und_MO' => 'zh_MO',
|
||||
'und_MQ' => 'fr_MQ',
|
||||
'und_MR' => 'ar_MR',
|
||||
'und_MT' => 'mt_MT',
|
||||
'und_MV' => 'dv_MV',
|
||||
'und_MW' => 'ny_MW',
|
||||
'und_MX' => 'es_MX',
|
||||
'und_MY' => 'ms_MY',
|
||||
'und_MZ' => 'pt_MZ',
|
||||
'und_Mlym' => 'ml_IN',
|
||||
'und_Mong' => 'mn_CN',
|
||||
'und_Mymr' => 'my_MM',
|
||||
'und_NC' => 'fr_NC',
|
||||
'und_NE' => 'ha_NE',
|
||||
'und_NG' => 'ha_NG',
|
||||
'und_NI' => 'es_NI',
|
||||
'und_NL' => 'nl_NL',
|
||||
'und_NO' => 'nb_NO',
|
||||
'und_NP' => 'ne_NP',
|
||||
'und_NR' => 'na_NR',
|
||||
'und_NU' => 'niu_NU',
|
||||
'und_OM' => 'ar_OM',
|
||||
'und_Orya' => 'or_IN',
|
||||
'und_PA' => 'es_PA',
|
||||
'und_PE' => 'es_PE',
|
||||
'und_PF' => 'ty_PF',
|
||||
'und_PG' => 'tpi_PG',
|
||||
'und_PH' => 'fil_PH',
|
||||
'und_PK' => 'ur_PK',
|
||||
'und_PL' => 'pl_PL',
|
||||
'und_PM' => 'fr_PM',
|
||||
'und_PR' => 'es_PR',
|
||||
'und_PS' => 'ar_PS',
|
||||
'und_PT' => 'pt_PT',
|
||||
'und_PW' => 'pau_PW',
|
||||
'und_PY' => 'gn_PY',
|
||||
'und_QA' => 'ar_QA',
|
||||
'und_RE' => 'fr_RE',
|
||||
'und_RO' => 'ro_RO',
|
||||
'und_RS' => 'sr_RS',
|
||||
'und_RU' => 'ru_RU',
|
||||
'und_RW' => 'rw_RW',
|
||||
'und_SA' => 'ar_SA',
|
||||
'und_SD' => 'ar_SD',
|
||||
'und_SE' => 'sv_SE',
|
||||
'und_SI' => 'sl_SI',
|
||||
'und_SJ' => 'nb_SJ',
|
||||
'und_SK' => 'sk_SK',
|
||||
'und_SM' => 'it_SM',
|
||||
'und_SN' => 'fr_SN',
|
||||
'und_SO' => 'so_SO',
|
||||
'und_SR' => 'nl_SR',
|
||||
'und_ST' => 'pt_ST',
|
||||
'und_SV' => 'es_SV',
|
||||
'und_SY' => 'ar_SY',
|
||||
'und_Sinh' => 'si_LK',
|
||||
'und_TD' => 'ar_TD',
|
||||
'und_TG' => 'ee_TG',
|
||||
'und_TH' => 'th_TH',
|
||||
'und_TJ' => 'tg_TJ',
|
||||
'und_TK' => 'tkl_TK',
|
||||
'und_TL' => 'tet_TL',
|
||||
'und_TM' => 'tk_TM',
|
||||
'und_TN' => 'ar_TN',
|
||||
'und_TO' => 'to_TO',
|
||||
'und_TR' => 'tr_TR',
|
||||
'und_TV' => 'tvl_TV',
|
||||
'und_TW' => 'zh_TW',
|
||||
'und_Taml' => 'ta_IN',
|
||||
'und_Telu' => 'te_IN',
|
||||
'und_Thaa' => 'dv_MV',
|
||||
'und_Thai' => 'th_TH',
|
||||
'und_Tibt' => 'bo_CN',
|
||||
'und_UA' => 'uk_UA',
|
||||
'und_UY' => 'es_UY',
|
||||
'und_UZ' => 'uz_UZ',
|
||||
'und_VA' => 'la_VA',
|
||||
'und_VE' => 'es_VE',
|
||||
'und_VN' => 'vi_VN',
|
||||
'und_VU' => 'fr_VU',
|
||||
'und_WF' => 'fr_WF',
|
||||
'und_WS' => 'sm_WS',
|
||||
'und_YE' => 'ar_YE',
|
||||
'und_YT' => 'fr_YT',
|
||||
'und_ZW' => 'sn_ZW',
|
||||
'ur' => 'ur_PK',
|
||||
'uz' => 'uz_UZ',
|
||||
'uz_AF' => 'uz_AF',
|
||||
'uz_Arab' => 'uz_AF',
|
||||
've' => 've_ZA',
|
||||
'vi' => 'vi_VN',
|
||||
'wal' => 'wal_ET',
|
||||
'war' => 'war_PH',
|
||||
'wo' => 'wo_SN',
|
||||
'xh' => 'xh_ZA',
|
||||
'yap' => 'yap_FM',
|
||||
'yo' => 'yo_NG',
|
||||
'za' => 'za_CN',
|
||||
'zh' => 'zh_CN',
|
||||
'zh_HK' => 'zh_HK',
|
||||
'zh_Hani' => 'zh_CN',
|
||||
'zh_Hant' => 'zh_TW',
|
||||
'zh_MO' => 'zh_MO',
|
||||
'zh_TW' => 'zh_TW',
|
||||
'zu' => 'zu_ZA',
|
||||
);
|
||||
|
||||
/**
|
||||
* This is the main translator function. Returns the string defined by $class and $entity according to the currently set locale.
|
||||
*
|
||||
@ -877,6 +1437,20 @@ class i18n extends Object {
|
||||
return $languages;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of commonly used locales
|
||||
*
|
||||
* @param boolean $native Use native names for locale instead of English ones
|
||||
* @return list of languages in the form 'code' => 'name'
|
||||
*/
|
||||
static function get_common_locales($native = false) {
|
||||
$languages = array();
|
||||
foreach (self::$common_locales as $code => $name) {
|
||||
$languages[$code] = ($native ? $name[1] : $name[0]);
|
||||
}
|
||||
return $languages;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of locales (code => language and country)
|
||||
*
|
||||
@ -922,7 +1496,9 @@ class i18n extends Object {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a name from a language code
|
||||
* Get a name from a language code (two characters, e.g. "en").
|
||||
*
|
||||
* @see get_locale_name()
|
||||
*
|
||||
* @param mixed $code Language code
|
||||
* @param boolean $native If true, the native name will be returned
|
||||
@ -934,7 +1510,9 @@ class i18n extends Object {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a name from a locale code (xx_YY)
|
||||
* Get a name from a locale code (xx_YY).
|
||||
*
|
||||
* @see get_language_name()
|
||||
*
|
||||
* @param mixed $code locale code
|
||||
* @return Name of the locale
|
||||
@ -1013,6 +1591,25 @@ class i18n extends Object {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides you "likely locales"
|
||||
* for a given "short" language code. This is a guess,
|
||||
* as we can't disambiguate from e.g. "en" to "en_US" - it
|
||||
* could also mean "en_UK". Based on the Unicode CLDR
|
||||
* project.
|
||||
* @see http://www.unicode.org/cldr/data/charts/supplemental/likely_subtags.html
|
||||
*
|
||||
* @param string $lang Short language code, e.g. "en"
|
||||
* @return string Long locale, e.g. "en_US"
|
||||
*/
|
||||
static function get_locale_from_lang($lang) {
|
||||
if(isset(self::$likely_subtags[$lang])) {
|
||||
return self::$likely_subtags[$lang];
|
||||
} else {
|
||||
return $lang . '_' . strtoupper($lang);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a RFC 1766 compatible language code,
|
||||
* e.g. "en-US".
|
||||
@ -1082,21 +1679,19 @@ class i18n extends Object {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set default language (proxy for Translatable::set_default_lang())
|
||||
*
|
||||
* @deprecated 2.4 Use Translatable::set_default_locale()
|
||||
* @param $lang String
|
||||
*/
|
||||
static function set_default_lang($lang) {
|
||||
Translatable::set_default_lang($lang);
|
||||
Translatable::set_default_locale($lang);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get default language (proxy for Translatable::default_lang())
|
||||
*
|
||||
* @deprecated 2.4 Use Translatable::default_locale()
|
||||
* @return String
|
||||
*/
|
||||
static function default_lang() {
|
||||
return Translatable::default_lang();
|
||||
return Translatable::default_locale();
|
||||
}
|
||||
|
||||
static function default_locale() {
|
||||
@ -1184,7 +1779,7 @@ class i18n extends Object {
|
||||
*/
|
||||
public function removelang() {
|
||||
if (!Permission::check("ADMIN")) user_error("You must be an admin to remove a language", E_USER_ERROR);
|
||||
$translatedToDelete = Translatable::get_by_lang('SiteTree',$this->urlParams['ID']);
|
||||
$translatedToDelete = Translatable::get_by_locale('SiteTree',$this->urlParams['ID']);
|
||||
foreach ($translatedToDelete as $object) {
|
||||
$object->delete();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user