2014-02-10 02:10:30 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/* translation.cpp */
|
|
|
|
/*************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
|
|
|
/* http://www.godotengine.org */
|
|
|
|
/*************************************************************************/
|
2017-01-01 22:01:57 +01:00
|
|
|
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
2014-02-10 02:10:30 +01:00
|
|
|
/* */
|
|
|
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
|
|
/* a copy of this software and associated documentation files (the */
|
|
|
|
/* "Software"), to deal in the Software without restriction, including */
|
|
|
|
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
|
|
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
|
|
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
|
|
/* the following conditions: */
|
|
|
|
/* */
|
|
|
|
/* The above copyright notice and this permission notice shall be */
|
|
|
|
/* included in all copies or substantial portions of the Software. */
|
|
|
|
/* */
|
|
|
|
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
|
|
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
|
|
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
|
|
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
|
|
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
|
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
|
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
|
|
/*************************************************************************/
|
|
|
|
#include "translation.h"
|
2017-01-16 08:04:19 +01:00
|
|
|
|
2017-02-21 04:05:15 +01:00
|
|
|
#include "global_config.h"
|
2014-02-10 02:10:30 +01:00
|
|
|
#include "io/resource_loader.h"
|
|
|
|
#include "os/os.h"
|
|
|
|
|
|
|
|
static const char* locale_list[]={
|
2016-09-01 23:42:03 +02:00
|
|
|
"aa", // Afar
|
|
|
|
"aa_DJ", // Afar (Djibouti)
|
|
|
|
"aa_ER", // Afar (Eritrea)
|
|
|
|
"aa_ET", // Afar (Ethiopia)
|
|
|
|
"af", // Afrikaans
|
|
|
|
"af_ZA", // Afrikaans (South Africa)
|
|
|
|
"agr_PE", // Aguaruna (Peru)
|
|
|
|
"ak_GH", // Akan (Ghana)
|
|
|
|
"am_ET", // Amharic (Ethiopia)
|
|
|
|
"an_ES", // Aragonese (Spain)
|
|
|
|
"anp_IN", // Angika (India)
|
2014-02-10 02:10:30 +01:00
|
|
|
"ar", // Arabic
|
|
|
|
"ar_AE", // Arabic (United Arab Emirates)
|
|
|
|
"ar_BH", // Arabic (Bahrain)
|
|
|
|
"ar_DZ", // Arabic (Algeria)
|
|
|
|
"ar_EG", // Arabic (Egypt)
|
2016-09-01 23:42:03 +02:00
|
|
|
"ar_IN", // Arabic (India)
|
2014-02-10 02:10:30 +01:00
|
|
|
"ar_IQ", // Arabic (Iraq)
|
|
|
|
"ar_JO", // Arabic (Jordan)
|
|
|
|
"ar_KW", // Arabic (Kuwait)
|
|
|
|
"ar_LB", // Arabic (Lebanon)
|
|
|
|
"ar_LY", // Arabic (Libya)
|
|
|
|
"ar_MA", // Arabic (Morocco)
|
|
|
|
"ar_OM", // Arabic (Oman)
|
|
|
|
"ar_QA", // Arabic (Qatar)
|
|
|
|
"ar_SA", // Arabic (Saudi Arabia)
|
|
|
|
"ar_SD", // Arabic (Sudan)
|
2016-09-01 23:42:03 +02:00
|
|
|
"ar_SS", // Arabic (South Soudan)
|
2014-02-10 02:10:30 +01:00
|
|
|
"ar_SY", // Arabic (Syria)
|
|
|
|
"ar_TN", // Arabic (Tunisia)
|
|
|
|
"ar_YE", // Arabic (Yemen)
|
2016-09-01 23:42:03 +02:00
|
|
|
"as_IN", // Assamese (India)
|
|
|
|
"ast_ES", // Asturian (Spain)
|
|
|
|
"ayc_PE", // Southern Aymara (Peru)
|
|
|
|
"ay_PE", // Aymara (Peru)
|
|
|
|
"az_AZ", // Azerbaijani (Azerbaijan)
|
2014-02-10 02:10:30 +01:00
|
|
|
"be", // Belarusian
|
|
|
|
"be_BY", // Belarusian (Belarus)
|
2016-09-01 23:42:03 +02:00
|
|
|
"bem_ZM", // Bemba (Zambia)
|
|
|
|
"ber_DZ", // Berber languages (Algeria)
|
|
|
|
"ber_MA", // Berber languages (Morocco)
|
2014-02-10 02:10:30 +01:00
|
|
|
"bg", // Bulgarian
|
|
|
|
"bg_BG", // Bulgarian (Bulgaria)
|
2016-09-01 23:42:03 +02:00
|
|
|
"bhb_IN", // Bhili (India)
|
|
|
|
"bho_IN", // Bhojpuri (India)
|
|
|
|
"bi_TV", // Bislama (Tuvalu)
|
2016-07-16 13:17:09 +02:00
|
|
|
"bn", // Bengali
|
|
|
|
"bn_BD", // Bengali (Bangladesh)
|
|
|
|
"bn_IN", // Bengali (India)
|
2016-09-01 23:42:03 +02:00
|
|
|
"bo", // Tibetan
|
|
|
|
"bo_CN", // Tibetan (China)
|
|
|
|
"bo_IN", // Tibetan (India)
|
|
|
|
"br_FR", // Breton (France)
|
|
|
|
"brx_IN", // Bodo (India)
|
|
|
|
"bs_BA", // Bosnian (Bosnia and Herzegovina)
|
|
|
|
"byn_ER", // Bilin (Eritrea)
|
2014-02-10 02:10:30 +01:00
|
|
|
"ca", // Catalan
|
2016-09-01 23:42:03 +02:00
|
|
|
"ca_AD", // Catalan (Andorra)
|
2014-02-10 02:10:30 +01:00
|
|
|
"ca_ES", // Catalan (Spain)
|
2016-09-01 23:42:03 +02:00
|
|
|
"ca_FR", // Catalan (France)
|
|
|
|
"ca_IT", // Catalan (Italy)
|
|
|
|
"ce_RU", // Chechen (Russia)
|
|
|
|
"chr_US", // Cherokee (United States)
|
|
|
|
"cmn_TW", // Mandarin Chinese (Taiwan)
|
|
|
|
"crh_UA", // Crimean Tatar (Ukraine)
|
|
|
|
"csb_PL", // Kashubian (Poland)
|
2014-02-10 02:10:30 +01:00
|
|
|
"cs", // Czech
|
|
|
|
"cs_CZ", // Czech (Czech Republic)
|
2016-09-01 23:42:03 +02:00
|
|
|
"cv_RU", // Chuvash (Russia)
|
|
|
|
"cy_GB", // Welsh (United Kingdom)
|
2014-02-10 02:10:30 +01:00
|
|
|
"da", // Danish
|
|
|
|
"da_DK", // Danish (Denmark)
|
|
|
|
"de", // German
|
|
|
|
"de_AT", // German (Austria)
|
2016-09-01 23:42:03 +02:00
|
|
|
"de_BE", // German (Belgium)
|
2014-02-10 02:10:30 +01:00
|
|
|
"de_CH", // German (Switzerland)
|
|
|
|
"de_DE", // German (Germany)
|
2016-09-01 23:42:03 +02:00
|
|
|
"de_IT", // German (Italy)
|
2014-02-10 02:10:30 +01:00
|
|
|
"de_LU", // German (Luxembourg)
|
2016-09-01 23:42:03 +02:00
|
|
|
"doi_IN", // Dogri (India)
|
|
|
|
"dv_MV", // Dhivehi (Maldives)
|
|
|
|
"dz_BT", // Dzongkha (Bhutan)
|
2014-02-10 02:10:30 +01:00
|
|
|
"el", // Greek
|
|
|
|
"el_CY", // Greek (Cyprus)
|
|
|
|
"el_GR", // Greek (Greece)
|
|
|
|
"en", // English
|
2016-09-01 23:42:03 +02:00
|
|
|
"en_AG", // English (Antigua and Barbuda)
|
2014-02-10 02:10:30 +01:00
|
|
|
"en_AU", // English (Australia)
|
2016-09-01 23:42:03 +02:00
|
|
|
"en_BW", // English (Botswana)
|
2014-02-10 02:10:30 +01:00
|
|
|
"en_CA", // English (Canada)
|
2016-09-01 23:42:03 +02:00
|
|
|
"en_DK", // English (Denmark)
|
2014-02-10 02:10:30 +01:00
|
|
|
"en_GB", // English (United Kingdom)
|
2016-09-01 23:42:03 +02:00
|
|
|
"en_HK", // English (Hong Kong)
|
2014-02-10 02:10:30 +01:00
|
|
|
"en_IE", // English (Ireland)
|
2016-09-01 23:42:03 +02:00
|
|
|
"en_IL", // English (Israel)
|
2014-02-10 02:10:30 +01:00
|
|
|
"en_IN", // English (India)
|
2016-09-01 23:42:03 +02:00
|
|
|
"en_NG", // English (Nigeria)
|
2014-02-10 02:10:30 +01:00
|
|
|
"en_NZ", // English (New Zealand)
|
|
|
|
"en_PH", // English (Philippines)
|
|
|
|
"en_SG", // English (Singapore)
|
|
|
|
"en_US", // English (United States)
|
|
|
|
"en_ZA", // English (South Africa)
|
2016-09-01 23:42:03 +02:00
|
|
|
"en_ZM", // English (Zambia)
|
|
|
|
"en_ZW", // English (Zimbabwe)
|
|
|
|
"eo", // Esperanto
|
2014-02-10 02:10:30 +01:00
|
|
|
"es", // Spanish
|
|
|
|
"es_AR", // Spanish (Argentina)
|
|
|
|
"es_BO", // Spanish (Bolivia)
|
|
|
|
"es_CL", // Spanish (Chile)
|
|
|
|
"es_CO", // Spanish (Colombia)
|
|
|
|
"es_CR", // Spanish (Costa Rica)
|
2016-09-01 23:42:03 +02:00
|
|
|
"es_CU", // Spanish (Cuba)
|
2014-02-10 02:10:30 +01:00
|
|
|
"es_DO", // Spanish (Dominican Republic)
|
|
|
|
"es_EC", // Spanish (Ecuador)
|
|
|
|
"es_ES", // Spanish (Spain)
|
|
|
|
"es_GT", // Spanish (Guatemala)
|
|
|
|
"es_HN", // Spanish (Honduras)
|
|
|
|
"es_MX", // Spanish (Mexico)
|
|
|
|
"es_NI", // Spanish (Nicaragua)
|
|
|
|
"es_PA", // Spanish (Panama)
|
|
|
|
"es_PE", // Spanish (Peru)
|
|
|
|
"es_PR", // Spanish (Puerto Rico)
|
|
|
|
"es_PY", // Spanish (Paraguay)
|
|
|
|
"es_SV", // Spanish (El Salvador)
|
|
|
|
"es_US", // Spanish (United States)
|
|
|
|
"es_UY", // Spanish (Uruguay)
|
|
|
|
"es_VE", // Spanish (Venezuela)
|
|
|
|
"et", // Estonian
|
|
|
|
"et_EE", // Estonian (Estonia)
|
2016-09-01 23:42:03 +02:00
|
|
|
"eu", // Basque
|
|
|
|
"eu_ES", // Basque (Spain)
|
|
|
|
"fa", // Persian
|
|
|
|
"fa_IR", // Persian (Iran)
|
|
|
|
"ff_SN", // Fulah (Senegal)
|
2014-02-10 02:10:30 +01:00
|
|
|
"fi", // Finnish
|
|
|
|
"fi_FI", // Finnish (Finland)
|
2016-09-01 23:42:03 +02:00
|
|
|
"fil_PH", // Filipino (Philippines)
|
|
|
|
"fo_FO", // Faroese (Faroe Islands)
|
2014-02-10 02:10:30 +01:00
|
|
|
"fr", // French
|
|
|
|
"fr_BE", // French (Belgium)
|
|
|
|
"fr_CA", // French (Canada)
|
|
|
|
"fr_CH", // French (Switzerland)
|
|
|
|
"fr_FR", // French (France)
|
|
|
|
"fr_LU", // French (Luxembourg)
|
2016-09-01 23:42:03 +02:00
|
|
|
"fur_IT", // Friulian (Italy)
|
|
|
|
"fy_DE", // Western Frisian (Germany)
|
|
|
|
"fy_NL", // Western Frisian (Netherlands)
|
2014-02-10 02:10:30 +01:00
|
|
|
"ga", // Irish
|
|
|
|
"ga_IE", // Irish (Ireland)
|
2016-09-01 23:42:03 +02:00
|
|
|
"gd_GB", // Scottish Gaelic (United Kingdom)
|
|
|
|
"gez_ER", // Geez (Eritrea)
|
|
|
|
"gez_ET", // Geez (Ethiopia)
|
|
|
|
"gl_ES", // Galician (Spain)
|
|
|
|
"gu_IN", // Gujarati (India)
|
|
|
|
"gv_GB", // Manx (United Kingdom)
|
|
|
|
"hak_TW", // Hakka Chinese (Taiwan)
|
|
|
|
"ha_NG", // Hausa (Nigeria)
|
|
|
|
"he", // Hebrew
|
|
|
|
"he_IL", // Hebrew (Israel)
|
|
|
|
"hi", // Hindi
|
2014-02-10 02:10:30 +01:00
|
|
|
"hi_IN", // Hindi (India)
|
2016-09-01 23:42:03 +02:00
|
|
|
"hne_IN", // Chhattisgarhi (India)
|
2014-02-10 02:10:30 +01:00
|
|
|
"hr", // Croatian
|
|
|
|
"hr_HR", // Croatian (Croatia)
|
2016-09-01 23:42:03 +02:00
|
|
|
"hsb_DE", // Upper Sorbian (Germany)
|
|
|
|
"ht_HT", // Haitian (Haiti)
|
2014-02-10 02:10:30 +01:00
|
|
|
"hu", // Hungarian
|
|
|
|
"hu_HU", // Hungarian (Hungary)
|
2016-09-01 23:42:03 +02:00
|
|
|
"hus_MX", // Huastec (Mexico)
|
|
|
|
"hy_AM", // Armenian (Armenia)
|
|
|
|
"ia_FR", // Interlingua (France)
|
|
|
|
"id", // Indonesian
|
|
|
|
"id_ID", // Indonesian (Indonesia)
|
|
|
|
"ig_NG", // Igbo (Nigeria)
|
|
|
|
"ik_CA", // Inupiaq (Canada)
|
2014-02-10 02:10:30 +01:00
|
|
|
"is", // Icelandic
|
|
|
|
"is_IS", // Icelandic (Iceland)
|
|
|
|
"it", // Italian
|
|
|
|
"it_CH", // Italian (Switzerland)
|
|
|
|
"it_IT", // Italian (Italy)
|
2016-09-01 23:42:03 +02:00
|
|
|
"iu_CA", // Inuktitut (Canada)
|
2014-02-10 02:10:30 +01:00
|
|
|
"ja", // Japanese
|
|
|
|
"ja_JP", // Japanese (Japan)
|
2016-09-01 23:42:03 +02:00
|
|
|
"kab_DZ", // Kabyle (Algeria)
|
|
|
|
"ka_GE", // Georgian (Georgia)
|
|
|
|
"kk_KZ", // Kazakh (Kazakhstan)
|
|
|
|
"kl_GL", // Kalaallisut (Greenland)
|
|
|
|
"km_KH", // Central Khmer (Cambodia)
|
|
|
|
"kn_IN", // Kannada (India)
|
|
|
|
"kok_IN", // Konkani (India)
|
2014-02-10 02:10:30 +01:00
|
|
|
"ko", // Korean
|
|
|
|
"ko_KR", // Korean (South Korea)
|
2016-09-01 23:42:03 +02:00
|
|
|
"ks_IN", // Kashmiri (India)
|
|
|
|
"ku", // Kurdish
|
|
|
|
"ku_TR", // Kurdish (Turkey)
|
|
|
|
"kw_GB", // Cornish (United Kingdom)
|
|
|
|
"ky_KG", // Kirghiz (Kyrgyzstan)
|
|
|
|
"lb_LU", // Luxembourgish (Luxembourg)
|
|
|
|
"lg_UG", // Ganda (Uganda)
|
|
|
|
"li_BE", // Limburgan (Belgium)
|
|
|
|
"li_NL", // Limburgan (Netherlands)
|
|
|
|
"lij_IT", // Ligurian (Italy)
|
|
|
|
"ln_CD", // Lingala (Congo)
|
|
|
|
"lo_LA", // Lao (Laos)
|
2014-02-10 02:10:30 +01:00
|
|
|
"lt", // Lithuanian
|
|
|
|
"lt_LT", // Lithuanian (Lithuania)
|
|
|
|
"lv", // Latvian
|
|
|
|
"lv_LV", // Latvian (Latvia)
|
2016-09-01 23:42:03 +02:00
|
|
|
"lzh_TW", // Literary Chinese (Taiwan)
|
|
|
|
"mag_IN", // Magahi (India)
|
|
|
|
"mai_IN", // Maithili (India)
|
|
|
|
"mg_MG", // Malagasy (Madagascar)
|
|
|
|
"mh_MH", // Marshallese (Marshall Islands)
|
|
|
|
"mhr_RU", // Eastern Mari (Russia)
|
|
|
|
"mi_NZ", // Maori (New Zealand)
|
|
|
|
"miq_NI", // Mískito (Nicaragua)
|
2014-02-10 02:10:30 +01:00
|
|
|
"mk", // Macedonian
|
|
|
|
"mk_MK", // Macedonian (Macedonia)
|
2016-09-01 23:42:03 +02:00
|
|
|
"ml_IN", // Malayalam (India)
|
|
|
|
"mni_IN", // Manipuri (India)
|
|
|
|
"mn_MN", // Mongolian (Mongolia)
|
|
|
|
"mr_IN", // Marathi (India)
|
2014-02-10 02:10:30 +01:00
|
|
|
"ms", // Malay
|
|
|
|
"ms_MY", // Malay (Malaysia)
|
|
|
|
"mt", // Maltese
|
|
|
|
"mt_MT", // Maltese (Malta)
|
2016-09-01 23:42:03 +02:00
|
|
|
"my_MM", // Burmese (Myanmar)
|
|
|
|
"myv_RU", // Erzya (Russia)
|
|
|
|
"nah_MX", // Nahuatl languages (Mexico)
|
|
|
|
"nan_TW", // Min Nan Chinese (Taiwan)
|
|
|
|
"nb", // Norwegian Bokmål
|
|
|
|
"nb_NO", // Norwegian Bokmål (Norway)
|
|
|
|
"nds_DE", // Low German (Germany)
|
|
|
|
"nds_NL", // Low German (Netherlands)
|
|
|
|
"ne_NP", // Nepali (Nepal)
|
|
|
|
"nhn_MX", // Central Nahuatl (Mexico)
|
|
|
|
"niu_NU", // Niuean (Niue)
|
|
|
|
"niu_NZ", // Niuean (New Zealand)
|
2014-02-10 02:10:30 +01:00
|
|
|
"nl", // Dutch
|
2016-09-01 23:42:03 +02:00
|
|
|
"nl_AW", // Dutch (Aruba)
|
2014-02-10 02:10:30 +01:00
|
|
|
"nl_BE", // Dutch (Belgium)
|
|
|
|
"nl_NL", // Dutch (Netherlands)
|
2016-09-01 23:42:03 +02:00
|
|
|
"nn", // Norwegian Nynorsk
|
|
|
|
"nn_NO", // Norwegian Nynorsk (Norway)
|
|
|
|
"nr_ZA", // South Ndebele (South Africa)
|
|
|
|
"nso_ZA", // Pedi (South Africa)
|
|
|
|
"oc_FR", // Occitan (France)
|
|
|
|
"om", // Oromo
|
|
|
|
"om_ET", // Oromo (Ethiopia)
|
|
|
|
"om_KE", // Oromo (Kenya)
|
|
|
|
"or_IN", // Oriya (India)
|
|
|
|
"os_RU", // Ossetian (Russia)
|
|
|
|
"pa_IN", // Panjabi (India)
|
|
|
|
"pap", // Papiamento
|
|
|
|
"pap_AN", // Papiamento (Netherlands Antilles)
|
|
|
|
"pap_AW", // Papiamento (Aruba)
|
|
|
|
"pap_CW", // Papiamento (Curaçao)
|
|
|
|
"pa_PK", // Panjabi (Pakistan)
|
2014-02-10 02:10:30 +01:00
|
|
|
"pl", // Polish
|
|
|
|
"pl_PL", // Polish (Poland)
|
2016-11-15 09:01:51 +01:00
|
|
|
"pr", // Pirate
|
2016-09-01 23:42:03 +02:00
|
|
|
"ps_AF", // Pushto (Afghanistan)
|
2014-02-10 02:10:30 +01:00
|
|
|
"pt", // Portuguese
|
|
|
|
"pt_BR", // Portuguese (Brazil)
|
|
|
|
"pt_PT", // Portuguese (Portugal)
|
2016-09-01 23:42:03 +02:00
|
|
|
"quy_PE", // Ayacucho Quechua (Peru)
|
|
|
|
"quz_PE", // Cusco Quechua (Peru)
|
|
|
|
"raj_IN", // Rajasthani (India)
|
2014-02-10 02:10:30 +01:00
|
|
|
"ro", // Romanian
|
|
|
|
"ro_RO", // Romanian (Romania)
|
|
|
|
"ru", // Russian
|
|
|
|
"ru_RU", // Russian (Russia)
|
2016-09-01 23:42:03 +02:00
|
|
|
"ru_UA", // Russian (Ukraine)
|
|
|
|
"rw_RW", // Kinyarwanda (Rwanda)
|
|
|
|
"sa_IN", // Sanskrit (India)
|
|
|
|
"sat_IN", // Santali (India)
|
|
|
|
"sc_IT", // Sardinian (Italy)
|
2017-01-08 16:48:25 +01:00
|
|
|
"sco", // Scots
|
2016-09-01 23:42:03 +02:00
|
|
|
"sd_IN", // Sindhi (India)
|
|
|
|
"se_NO", // Northern Sami (Norway)
|
|
|
|
"sgs_LT", // Samogitian (Lithuania)
|
|
|
|
"shs_CA", // Shuswap (Canada)
|
|
|
|
"sid_ET", // Sidamo (Ethiopia)
|
|
|
|
"si_LK", // Sinhala (Sri Lanka)
|
2014-02-10 02:10:30 +01:00
|
|
|
"sk", // Slovak
|
|
|
|
"sk_SK", // Slovak (Slovakia)
|
|
|
|
"sl", // Slovenian
|
|
|
|
"sl_SI", // Slovenian (Slovenia)
|
2016-09-01 23:42:03 +02:00
|
|
|
"so", // Somali
|
|
|
|
"so_DJ", // Somali (Djibouti)
|
|
|
|
"so_ET", // Somali (Ethiopia)
|
|
|
|
"so_KE", // Somali (Kenya)
|
|
|
|
"so_SO", // Somali (Somalia)
|
|
|
|
"son_ML", // Songhai languages (Mali)
|
2014-02-10 02:10:30 +01:00
|
|
|
"sq", // Albanian
|
|
|
|
"sq_AL", // Albanian (Albania)
|
2016-09-01 23:42:03 +02:00
|
|
|
"sq_KV", // Albanian (Kosovo)
|
|
|
|
"sq_MK", // Albanian (Macedonia)
|
2014-02-10 02:10:30 +01:00
|
|
|
"sr", // Serbian
|
|
|
|
"sr_ME", // Serbian (Montenegro)
|
|
|
|
"sr_RS", // Serbian (Serbia)
|
2016-09-01 23:42:03 +02:00
|
|
|
"ss_ZA", // Swati (South Africa)
|
|
|
|
"st_ZA", // Southern Sotho (South Africa)
|
2014-02-10 02:10:30 +01:00
|
|
|
"sv", // Swedish
|
2016-09-01 23:42:03 +02:00
|
|
|
"sv_FI", // Swedish (Finland)
|
2014-02-10 02:10:30 +01:00
|
|
|
"sv_SE", // Swedish (Sweden)
|
2016-09-01 23:42:03 +02:00
|
|
|
"sw_KE", // Swahili (Kenya)
|
|
|
|
"sw_TZ", // Swahili (Tanzania)
|
|
|
|
"szl_PL", // Silesian (Poland)
|
|
|
|
"ta", // Tamil
|
|
|
|
"ta_IN", // Tamil (India)
|
|
|
|
"ta_LK", // Tamil (Sri Lanka)
|
|
|
|
"tcy_IN", // Tulu (India)
|
|
|
|
"te_IN", // Telugu (India)
|
|
|
|
"tg_TJ", // Tajik (Tajikistan)
|
|
|
|
"the_NP", // Chitwania Tharu (Nepal)
|
2014-02-10 02:10:30 +01:00
|
|
|
"th", // Thai
|
|
|
|
"th_TH", // Thai (Thailand)
|
2016-09-01 23:42:03 +02:00
|
|
|
"ti", // Tigrinya
|
|
|
|
"ti_ER", // Tigrinya (Eritrea)
|
|
|
|
"ti_ET", // Tigrinya (Ethiopia)
|
|
|
|
"tig_ER", // Tigre (Eritrea)
|
|
|
|
"tk_TM", // Turkmen (Turkmenistan)
|
|
|
|
"tl_PH", // Tagalog (Philippines)
|
|
|
|
"tn_ZA", // Tswana (South Africa)
|
2014-02-10 02:10:30 +01:00
|
|
|
"tr", // Turkish
|
2016-09-01 23:42:03 +02:00
|
|
|
"tr_CY", // Turkish (Cyprus)
|
2014-02-10 02:10:30 +01:00
|
|
|
"tr_TR", // Turkish (Turkey)
|
2016-09-01 23:42:03 +02:00
|
|
|
"ts_ZA", // Tsonga (South Africa)
|
|
|
|
"tt_RU", // Tatar (Russia)
|
|
|
|
"ug_CN", // Uighur (China)
|
2014-02-10 02:10:30 +01:00
|
|
|
"uk", // Ukrainian
|
|
|
|
"uk_UA", // Ukrainian (Ukraine)
|
2016-09-01 23:42:03 +02:00
|
|
|
"unm_US", // Unami (United States)
|
2016-07-16 13:17:09 +02:00
|
|
|
"ur", // Urdu
|
|
|
|
"ur_IN", // Urdu (India)
|
|
|
|
"ur_PK", // Urdu (Pakistan)
|
2016-09-01 23:42:03 +02:00
|
|
|
"uz", // Uzbek
|
|
|
|
"uz_UZ", // Uzbek (Uzbekistan)
|
|
|
|
"ve_ZA", // Venda (South Africa)
|
2014-02-10 02:10:30 +01:00
|
|
|
"vi", // Vietnamese
|
|
|
|
"vi_VN", // Vietnamese (Vietnam)
|
2016-09-01 23:42:03 +02:00
|
|
|
"wa_BE", // Walloon (Belgium)
|
|
|
|
"wae_CH", // Walser (Switzerland)
|
|
|
|
"wal_ET", // Wolaytta (Ethiopia)
|
|
|
|
"wo_SN", // Wolof (Senegal)
|
|
|
|
"xh_ZA", // Xhosa (South Africa)
|
|
|
|
"yi_US", // Yiddish (United States)
|
|
|
|
"yo_NG", // Yoruba (Nigeria)
|
|
|
|
"yue_HK", // Yue Chinese (Hong Kong)
|
2014-02-10 02:10:30 +01:00
|
|
|
"zh", // Chinese
|
|
|
|
"zh_CN", // Chinese (China)
|
|
|
|
"zh_HK", // Chinese (Hong Kong)
|
|
|
|
"zh_SG", // Chinese (Singapore)
|
|
|
|
"zh_TW", // Chinese (Taiwan)
|
2016-09-01 23:42:03 +02:00
|
|
|
"zu_ZA", // Zulu (South Africa)
|
2014-02-10 02:10:30 +01:00
|
|
|
0
|
|
|
|
};
|
|
|
|
|
|
|
|
static const char* locale_names[]={
|
2016-09-01 23:42:03 +02:00
|
|
|
"Afar",
|
|
|
|
"Afar (Djibouti)",
|
|
|
|
"Afar (Eritrea)",
|
|
|
|
"Afar (Ethiopia)",
|
|
|
|
"Afrikaans",
|
|
|
|
"Afrikaans (South Africa)",
|
|
|
|
"Aguaruna (Peru)",
|
|
|
|
"Akan (Ghana)",
|
|
|
|
"Amharic (Ethiopia)",
|
|
|
|
"Aragonese (Spain)",
|
|
|
|
"Angika (India)",
|
2014-02-10 02:10:30 +01:00
|
|
|
"Arabic",
|
|
|
|
"Arabic (United Arab Emirates)",
|
|
|
|
"Arabic (Bahrain)",
|
|
|
|
"Arabic (Algeria)",
|
|
|
|
"Arabic (Egypt)",
|
2016-09-01 23:42:03 +02:00
|
|
|
"Arabic (India)",
|
2014-02-10 02:10:30 +01:00
|
|
|
"Arabic (Iraq)",
|
|
|
|
"Arabic (Jordan)",
|
|
|
|
"Arabic (Kuwait)",
|
|
|
|
"Arabic (Lebanon)",
|
|
|
|
"Arabic (Libya)",
|
|
|
|
"Arabic (Morocco)",
|
|
|
|
"Arabic (Oman)",
|
|
|
|
"Arabic (Qatar)",
|
|
|
|
"Arabic (Saudi Arabia)",
|
|
|
|
"Arabic (Sudan)",
|
2016-09-01 23:42:03 +02:00
|
|
|
"Arabic (South Soudan)",
|
2014-02-10 02:10:30 +01:00
|
|
|
"Arabic (Syria)",
|
|
|
|
"Arabic (Tunisia)",
|
|
|
|
"Arabic (Yemen)",
|
2016-09-01 23:42:03 +02:00
|
|
|
"Assamese (India)",
|
|
|
|
"Asturian (Spain)",
|
|
|
|
"Southern Aymara (Peru)",
|
|
|
|
"Aymara (Peru)",
|
|
|
|
"Azerbaijani (Azerbaijan)",
|
2014-02-10 02:10:30 +01:00
|
|
|
"Belarusian",
|
|
|
|
"Belarusian (Belarus)",
|
2016-09-01 23:42:03 +02:00
|
|
|
"Bemba (Zambia)",
|
|
|
|
"Berber languages (Algeria)",
|
|
|
|
"Berber languages (Morocco)",
|
2014-02-10 02:10:30 +01:00
|
|
|
"Bulgarian",
|
|
|
|
"Bulgarian (Bulgaria)",
|
2016-09-01 23:42:03 +02:00
|
|
|
"Bhili (India)",
|
|
|
|
"Bhojpuri (India)",
|
|
|
|
"Bislama (Tuvalu)",
|
2016-07-16 13:17:09 +02:00
|
|
|
"Bengali",
|
|
|
|
"Bengali (Bangladesh)",
|
|
|
|
"Bengali (India)",
|
2016-09-01 23:42:03 +02:00
|
|
|
"Tibetan",
|
|
|
|
"Tibetan (China)",
|
|
|
|
"Tibetan (India)",
|
|
|
|
"Breton (France)",
|
|
|
|
"Bodo (India)",
|
|
|
|
"Bosnian (Bosnia and Herzegovina)",
|
|
|
|
"Bilin (Eritrea)",
|
2014-02-10 02:10:30 +01:00
|
|
|
"Catalan",
|
2016-09-01 23:42:03 +02:00
|
|
|
"Catalan (Andorra)",
|
2014-02-10 02:10:30 +01:00
|
|
|
"Catalan (Spain)",
|
2016-09-01 23:42:03 +02:00
|
|
|
"Catalan (France)",
|
|
|
|
"Catalan (Italy)",
|
|
|
|
"Chechen (Russia)",
|
|
|
|
"Cherokee (United States)",
|
|
|
|
"Mandarin Chinese (Taiwan)",
|
|
|
|
"Crimean Tatar (Ukraine)",
|
|
|
|
"Kashubian (Poland)",
|
2014-02-10 02:10:30 +01:00
|
|
|
"Czech",
|
|
|
|
"Czech (Czech Republic)",
|
2016-09-01 23:42:03 +02:00
|
|
|
"Chuvash (Russia)",
|
|
|
|
"Welsh (United Kingdom)",
|
2014-02-10 02:10:30 +01:00
|
|
|
"Danish",
|
|
|
|
"Danish (Denmark)",
|
|
|
|
"German",
|
|
|
|
"German (Austria)",
|
2016-09-01 23:42:03 +02:00
|
|
|
"German (Belgium)",
|
2014-02-10 02:10:30 +01:00
|
|
|
"German (Switzerland)",
|
|
|
|
"German (Germany)",
|
2016-09-01 23:42:03 +02:00
|
|
|
"German (Italy)",
|
2014-02-10 02:10:30 +01:00
|
|
|
"German (Luxembourg)",
|
2016-09-01 23:42:03 +02:00
|
|
|
"Dogri (India)",
|
|
|
|
"Dhivehi (Maldives)",
|
|
|
|
"Dzongkha (Bhutan)",
|
2014-02-10 02:10:30 +01:00
|
|
|
"Greek",
|
|
|
|
"Greek (Cyprus)",
|
|
|
|
"Greek (Greece)",
|
|
|
|
"English",
|
2016-09-01 23:42:03 +02:00
|
|
|
"English (Antigua and Barbuda)",
|
2014-02-10 02:10:30 +01:00
|
|
|
"English (Australia)",
|
2016-09-01 23:42:03 +02:00
|
|
|
"English (Botswana)",
|
2014-02-10 02:10:30 +01:00
|
|
|
"English (Canada)",
|
2016-09-01 23:42:03 +02:00
|
|
|
"English (Denmark)",
|
2014-02-10 02:10:30 +01:00
|
|
|
"English (United Kingdom)",
|
2016-09-01 23:42:03 +02:00
|
|
|
"English (Hong Kong)",
|
2014-02-10 02:10:30 +01:00
|
|
|
"English (Ireland)",
|
2016-09-01 23:42:03 +02:00
|
|
|
"English (Israel)",
|
2014-02-10 02:10:30 +01:00
|
|
|
"English (India)",
|
2016-09-01 23:42:03 +02:00
|
|
|
"English (Nigeria)",
|
2014-02-10 02:10:30 +01:00
|
|
|
"English (New Zealand)",
|
|
|
|
"English (Philippines)",
|
|
|
|
"English (Singapore)",
|
|
|
|
"English (United States)",
|
|
|
|
"English (South Africa)",
|
2016-09-01 23:42:03 +02:00
|
|
|
"English (Zambia)",
|
|
|
|
"English (Zimbabwe)",
|
|
|
|
"Esperanto",
|
2014-02-10 02:10:30 +01:00
|
|
|
"Spanish",
|
|
|
|
"Spanish (Argentina)",
|
|
|
|
"Spanish (Bolivia)",
|
|
|
|
"Spanish (Chile)",
|
|
|
|
"Spanish (Colombia)",
|
|
|
|
"Spanish (Costa Rica)",
|
2016-09-01 23:42:03 +02:00
|
|
|
"Spanish (Cuba)",
|
2014-02-10 02:10:30 +01:00
|
|
|
"Spanish (Dominican Republic)",
|
|
|
|
"Spanish (Ecuador)",
|
|
|
|
"Spanish (Spain)",
|
|
|
|
"Spanish (Guatemala)",
|
|
|
|
"Spanish (Honduras)",
|
|
|
|
"Spanish (Mexico)",
|
|
|
|
"Spanish (Nicaragua)",
|
|
|
|
"Spanish (Panama)",
|
|
|
|
"Spanish (Peru)",
|
|
|
|
"Spanish (Puerto Rico)",
|
|
|
|
"Spanish (Paraguay)",
|
|
|
|
"Spanish (El Salvador)",
|
|
|
|
"Spanish (United States)",
|
|
|
|
"Spanish (Uruguay)",
|
|
|
|
"Spanish (Venezuela)",
|
|
|
|
"Estonian",
|
|
|
|
"Estonian (Estonia)",
|
2016-09-01 23:42:03 +02:00
|
|
|
"Basque",
|
|
|
|
"Basque (Spain)",
|
|
|
|
"Persian",
|
|
|
|
"Persian (Iran)",
|
|
|
|
"Fulah (Senegal)",
|
2014-02-10 02:10:30 +01:00
|
|
|
"Finnish",
|
|
|
|
"Finnish (Finland)",
|
2016-09-01 23:42:03 +02:00
|
|
|
"Filipino (Philippines)",
|
|
|
|
"Faroese (Faroe Islands)",
|
2014-02-10 02:10:30 +01:00
|
|
|
"French",
|
|
|
|
"French (Belgium)",
|
|
|
|
"French (Canada)",
|
|
|
|
"French (Switzerland)",
|
|
|
|
"French (France)",
|
|
|
|
"French (Luxembourg)",
|
2016-09-01 23:42:03 +02:00
|
|
|
"Friulian (Italy)",
|
|
|
|
"Western Frisian (Germany)",
|
|
|
|
"Western Frisian (Netherlands)",
|
2014-02-10 02:10:30 +01:00
|
|
|
"Irish",
|
|
|
|
"Irish (Ireland)",
|
2016-09-01 23:42:03 +02:00
|
|
|
"Scottish Gaelic (United Kingdom)",
|
|
|
|
"Geez (Eritrea)",
|
|
|
|
"Geez (Ethiopia)",
|
|
|
|
"Galician (Spain)",
|
|
|
|
"Gujarati (India)",
|
|
|
|
"Manx (United Kingdom)",
|
|
|
|
"Hakka Chinese (Taiwan)",
|
|
|
|
"Hausa (Nigeria)",
|
|
|
|
"Hebrew",
|
|
|
|
"Hebrew (Israel)",
|
|
|
|
"Hindi",
|
2014-02-10 02:10:30 +01:00
|
|
|
"Hindi (India)",
|
2016-09-01 23:42:03 +02:00
|
|
|
"Chhattisgarhi (India)",
|
2014-02-10 02:10:30 +01:00
|
|
|
"Croatian",
|
|
|
|
"Croatian (Croatia)",
|
2016-09-01 23:42:03 +02:00
|
|
|
"Upper Sorbian (Germany)",
|
|
|
|
"Haitian (Haiti)",
|
2014-02-10 02:10:30 +01:00
|
|
|
"Hungarian",
|
|
|
|
"Hungarian (Hungary)",
|
2016-09-01 23:42:03 +02:00
|
|
|
"Huastec (Mexico)",
|
|
|
|
"Armenian (Armenia)",
|
|
|
|
"Interlingua (France)",
|
2014-02-10 02:10:30 +01:00
|
|
|
"Indonesian",
|
|
|
|
"Indonesian (Indonesia)",
|
2016-09-01 23:42:03 +02:00
|
|
|
"Igbo (Nigeria)",
|
|
|
|
"Inupiaq (Canada)",
|
2014-02-10 02:10:30 +01:00
|
|
|
"Icelandic",
|
|
|
|
"Icelandic (Iceland)",
|
|
|
|
"Italian",
|
|
|
|
"Italian (Switzerland)",
|
|
|
|
"Italian (Italy)",
|
2016-09-01 23:42:03 +02:00
|
|
|
"Inuktitut (Canada)",
|
2014-02-10 02:10:30 +01:00
|
|
|
"Japanese",
|
|
|
|
"Japanese (Japan)",
|
2016-09-01 23:42:03 +02:00
|
|
|
"Kabyle (Algeria)",
|
|
|
|
"Georgian (Georgia)",
|
|
|
|
"Kazakh (Kazakhstan)",
|
|
|
|
"Kalaallisut (Greenland)",
|
|
|
|
"Central Khmer (Cambodia)",
|
|
|
|
"Kannada (India)",
|
|
|
|
"Konkani (India)",
|
2014-02-10 02:10:30 +01:00
|
|
|
"Korean",
|
|
|
|
"Korean (South Korea)",
|
2016-09-01 23:42:03 +02:00
|
|
|
"Kashmiri (India)",
|
|
|
|
"Kurdish",
|
|
|
|
"Kurdish (Turkey)",
|
|
|
|
"Cornish (United Kingdom)",
|
|
|
|
"Kirghiz (Kyrgyzstan)",
|
|
|
|
"Luxembourgish (Luxembourg)",
|
|
|
|
"Ganda (Uganda)",
|
|
|
|
"Limburgan (Belgium)",
|
|
|
|
"Limburgan (Netherlands)",
|
|
|
|
"Ligurian (Italy)",
|
|
|
|
"Lingala (Congo)",
|
|
|
|
"Lao (Laos)",
|
2014-02-10 02:10:30 +01:00
|
|
|
"Lithuanian",
|
|
|
|
"Lithuanian (Lithuania)",
|
|
|
|
"Latvian",
|
|
|
|
"Latvian (Latvia)",
|
2016-09-01 23:42:03 +02:00
|
|
|
"Literary Chinese (Taiwan)",
|
|
|
|
"Magahi (India)",
|
|
|
|
"Maithili (India)",
|
|
|
|
"Malagasy (Madagascar)",
|
|
|
|
"Marshallese (Marshall Islands)",
|
|
|
|
"Eastern Mari (Russia)",
|
|
|
|
"Maori (New Zealand)",
|
|
|
|
"Mískito (Nicaragua)",
|
2014-02-10 02:10:30 +01:00
|
|
|
"Macedonian",
|
|
|
|
"Macedonian (Macedonia)",
|
2016-09-01 23:42:03 +02:00
|
|
|
"Malayalam (India)",
|
|
|
|
"Manipuri (India)",
|
|
|
|
"Mongolian (Mongolia)",
|
|
|
|
"Marathi (India)",
|
2014-02-10 02:10:30 +01:00
|
|
|
"Malay",
|
|
|
|
"Malay (Malaysia)",
|
|
|
|
"Maltese",
|
|
|
|
"Maltese (Malta)",
|
2016-09-01 23:42:03 +02:00
|
|
|
"Burmese (Myanmar)",
|
|
|
|
"Erzya (Russia)",
|
|
|
|
"Nahuatl languages (Mexico)",
|
|
|
|
"Min Nan Chinese (Taiwan)",
|
|
|
|
"Norwegian Bokmål",
|
|
|
|
"Norwegian Bokmål (Norway)",
|
|
|
|
"Low German (Germany)",
|
|
|
|
"Low German (Netherlands)",
|
|
|
|
"Nepali (Nepal)",
|
|
|
|
"Central Nahuatl (Mexico)",
|
|
|
|
"Niuean (Niue)",
|
|
|
|
"Niuean (New Zealand)",
|
2014-02-10 02:10:30 +01:00
|
|
|
"Dutch",
|
2016-09-01 23:42:03 +02:00
|
|
|
"Dutch (Aruba)",
|
2014-02-10 02:10:30 +01:00
|
|
|
"Dutch (Belgium)",
|
|
|
|
"Dutch (Netherlands)",
|
2016-09-01 23:42:03 +02:00
|
|
|
"Norwegian Nynorsk",
|
|
|
|
"Norwegian Nynorsk (Norway)",
|
|
|
|
"South Ndebele (South Africa)",
|
|
|
|
"Pedi (South Africa)",
|
|
|
|
"Occitan (France)",
|
|
|
|
"Oromo",
|
|
|
|
"Oromo (Ethiopia)",
|
|
|
|
"Oromo (Kenya)",
|
|
|
|
"Oriya (India)",
|
|
|
|
"Ossetian (Russia)",
|
|
|
|
"Panjabi (India)",
|
|
|
|
"Papiamento",
|
|
|
|
"Papiamento (Netherlands Antilles)",
|
|
|
|
"Papiamento (Aruba)",
|
|
|
|
"Papiamento (Curaçao)",
|
|
|
|
"Panjabi (Pakistan)",
|
2014-02-10 02:10:30 +01:00
|
|
|
"Polish",
|
|
|
|
"Polish (Poland)",
|
2016-11-15 09:01:51 +01:00
|
|
|
"Pirate",
|
2016-09-01 23:42:03 +02:00
|
|
|
"Pushto (Afghanistan)",
|
2014-02-10 02:10:30 +01:00
|
|
|
"Portuguese",
|
|
|
|
"Portuguese (Brazil)",
|
|
|
|
"Portuguese (Portugal)",
|
2016-09-01 23:42:03 +02:00
|
|
|
"Ayacucho Quechua (Peru)",
|
|
|
|
"Cusco Quechua (Peru)",
|
|
|
|
"Rajasthani (India)",
|
2014-02-10 02:10:30 +01:00
|
|
|
"Romanian",
|
|
|
|
"Romanian (Romania)",
|
|
|
|
"Russian",
|
|
|
|
"Russian (Russia)",
|
2016-09-01 23:42:03 +02:00
|
|
|
"Russian (Ukraine)",
|
|
|
|
"Kinyarwanda (Rwanda)",
|
|
|
|
"Sanskrit (India)",
|
|
|
|
"Santali (India)",
|
|
|
|
"Sardinian (Italy)",
|
2017-02-08 15:54:28 +01:00
|
|
|
"Scots (Scotland)",
|
2016-09-01 23:42:03 +02:00
|
|
|
"Sindhi (India)",
|
|
|
|
"Northern Sami (Norway)",
|
|
|
|
"Samogitian (Lithuania)",
|
|
|
|
"Shuswap (Canada)",
|
|
|
|
"Sidamo (Ethiopia)",
|
|
|
|
"Sinhala (Sri Lanka)",
|
2014-02-10 02:10:30 +01:00
|
|
|
"Slovak",
|
|
|
|
"Slovak (Slovakia)",
|
|
|
|
"Slovenian",
|
|
|
|
"Slovenian (Slovenia)",
|
2016-09-01 23:42:03 +02:00
|
|
|
"Somali",
|
|
|
|
"Somali (Djibouti)",
|
|
|
|
"Somali (Ethiopia)",
|
|
|
|
"Somali (Kenya)",
|
|
|
|
"Somali (Somalia)",
|
|
|
|
"Songhai languages (Mali)",
|
2014-02-10 02:10:30 +01:00
|
|
|
"Albanian",
|
|
|
|
"Albanian (Albania)",
|
2016-09-01 23:42:03 +02:00
|
|
|
"Albanian (Kosovo)",
|
|
|
|
"Albanian (Macedonia)",
|
2014-02-10 02:10:30 +01:00
|
|
|
"Serbian",
|
|
|
|
"Serbian (Montenegro)",
|
|
|
|
"Serbian (Serbia)",
|
2016-09-01 23:42:03 +02:00
|
|
|
"Swati (South Africa)",
|
|
|
|
"Southern Sotho (South Africa)",
|
2014-02-10 02:10:30 +01:00
|
|
|
"Swedish",
|
2016-09-01 23:42:03 +02:00
|
|
|
"Swedish (Finland)",
|
2014-02-10 02:10:30 +01:00
|
|
|
"Swedish (Sweden)",
|
2016-09-01 23:42:03 +02:00
|
|
|
"Swahili (Kenya)",
|
|
|
|
"Swahili (Tanzania)",
|
|
|
|
"Silesian (Poland)",
|
|
|
|
"Tamil",
|
|
|
|
"Tamil (India)",
|
|
|
|
"Tamil (Sri Lanka)",
|
|
|
|
"Tulu (India)",
|
|
|
|
"Telugu (India)",
|
|
|
|
"Tajik (Tajikistan)",
|
|
|
|
"Chitwania Tharu (Nepal)",
|
2014-02-10 02:10:30 +01:00
|
|
|
"Thai",
|
|
|
|
"Thai (Thailand)",
|
2016-09-01 23:42:03 +02:00
|
|
|
"Tigrinya",
|
|
|
|
"Tigrinya (Eritrea)",
|
|
|
|
"Tigrinya (Ethiopia)",
|
|
|
|
"Tigre (Eritrea)",
|
|
|
|
"Turkmen (Turkmenistan)",
|
|
|
|
"Tagalog (Philippines)",
|
|
|
|
"Tswana (South Africa)",
|
2014-02-10 02:10:30 +01:00
|
|
|
"Turkish",
|
2016-09-01 23:42:03 +02:00
|
|
|
"Turkish (Cyprus)",
|
2014-02-10 02:10:30 +01:00
|
|
|
"Turkish (Turkey)",
|
2016-09-01 23:42:03 +02:00
|
|
|
"Tsonga (South Africa)",
|
|
|
|
"Tatar (Russia)",
|
|
|
|
"Uighur (China)",
|
2014-02-10 02:10:30 +01:00
|
|
|
"Ukrainian",
|
|
|
|
"Ukrainian (Ukraine)",
|
2016-09-01 23:42:03 +02:00
|
|
|
"Unami (United States)",
|
2016-07-16 13:17:09 +02:00
|
|
|
"Urdu",
|
|
|
|
"Urdu (India)",
|
|
|
|
"Urdu (Pakistan)",
|
2016-09-01 23:42:03 +02:00
|
|
|
"Uzbek",
|
|
|
|
"Uzbek (Uzbekistan)",
|
|
|
|
"Venda (South Africa)",
|
2014-02-10 02:10:30 +01:00
|
|
|
"Vietnamese",
|
|
|
|
"Vietnamese (Vietnam)",
|
2016-09-01 23:42:03 +02:00
|
|
|
"Walloon (Belgium)",
|
|
|
|
"Walser (Switzerland)",
|
|
|
|
"Wolaytta (Ethiopia)",
|
|
|
|
"Wolof (Senegal)",
|
|
|
|
"Xhosa (South Africa)",
|
|
|
|
"Yiddish (United States)",
|
|
|
|
"Yoruba (Nigeria)",
|
|
|
|
"Yue Chinese (Hong Kong)",
|
2014-02-10 02:10:30 +01:00
|
|
|
"Chinese",
|
|
|
|
"Chinese (China)",
|
|
|
|
"Chinese (Hong Kong)",
|
|
|
|
"Chinese (Singapore)",
|
|
|
|
"Chinese (Taiwan)",
|
2016-09-01 23:42:03 +02:00
|
|
|
"Zulu (South Africa)",
|
2014-02-10 02:10:30 +01:00
|
|
|
0
|
|
|
|
};
|
|
|
|
|
2017-02-02 00:41:05 +01:00
|
|
|
bool TranslationServer::is_locale_valid(const String& p_locale) {
|
|
|
|
|
|
|
|
const char **ptr=locale_list;
|
|
|
|
|
|
|
|
while (*ptr) {
|
|
|
|
|
|
|
|
if (*ptr==p_locale)
|
|
|
|
return true;
|
|
|
|
ptr++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
Vector<String> TranslationServer::get_all_locales() {
|
|
|
|
|
|
|
|
Vector<String> locales;
|
|
|
|
|
|
|
|
const char **ptr=locale_list;
|
|
|
|
|
|
|
|
while (*ptr) {
|
|
|
|
locales.push_back(*ptr);
|
|
|
|
ptr++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return locales;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Vector<String> TranslationServer::get_all_locale_names(){
|
|
|
|
|
|
|
|
Vector<String> locales;
|
|
|
|
|
|
|
|
const char **ptr=locale_names;
|
|
|
|
|
|
|
|
while (*ptr) {
|
|
|
|
locales.push_back(*ptr);
|
|
|
|
ptr++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return locales;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-10-27 10:36:32 +02:00
|
|
|
static String get_trimmed_locale(const String& p_locale) {
|
|
|
|
|
|
|
|
return p_locale.substr(0,2);
|
|
|
|
}
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
static bool is_valid_locale(const String& p_locale) {
|
|
|
|
|
|
|
|
const char **ptr=locale_list;
|
|
|
|
|
|
|
|
while (*ptr) {
|
|
|
|
if (p_locale==*ptr)
|
|
|
|
return true;
|
|
|
|
ptr++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2017-01-07 22:25:37 +01:00
|
|
|
PoolVector<String> Translation::_get_messages() const {
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-01-07 22:25:37 +01:00
|
|
|
PoolVector<String> msgs;
|
2014-02-10 02:10:30 +01:00
|
|
|
msgs.resize(translation_map.size()*2);
|
|
|
|
int idx=0;
|
|
|
|
for (const Map<StringName, StringName>::Element *E=translation_map.front();E;E=E->next()) {
|
|
|
|
|
|
|
|
msgs.set(idx+0,E->key());
|
|
|
|
msgs.set(idx+1,E->get());
|
|
|
|
idx+=2;
|
|
|
|
}
|
|
|
|
|
|
|
|
return msgs;
|
|
|
|
}
|
|
|
|
|
2017-01-07 22:25:37 +01:00
|
|
|
PoolVector<String> Translation::_get_message_list() const {
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-01-07 22:25:37 +01:00
|
|
|
PoolVector<String> msgs;
|
2014-02-10 02:10:30 +01:00
|
|
|
msgs.resize(translation_map.size());
|
|
|
|
int idx=0;
|
|
|
|
for (const Map<StringName, StringName>::Element *E=translation_map.front();E;E=E->next()) {
|
|
|
|
|
|
|
|
msgs.set(idx,E->key());
|
|
|
|
idx+=1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return msgs;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2017-01-07 22:25:37 +01:00
|
|
|
void Translation::_set_messages(const PoolVector<String>& p_messages){
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
int msg_count=p_messages.size();
|
|
|
|
ERR_FAIL_COND(msg_count%2);
|
|
|
|
|
2017-01-07 22:25:37 +01:00
|
|
|
PoolVector<String>::Read r = p_messages.read();
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
for(int i=0;i<msg_count;i+=2) {
|
|
|
|
|
|
|
|
add_message( r[i+0], r[i+1] );
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Translation::set_locale(const String& p_locale) {
|
|
|
|
|
2016-10-27 14:29:00 +02:00
|
|
|
// replaces '-' with '_' for macOS Sierra-style locales
|
|
|
|
String univ_locale = p_locale.replace("-", "_");
|
|
|
|
|
|
|
|
if(!is_valid_locale(univ_locale)) {
|
|
|
|
String trimmed_locale = get_trimmed_locale(univ_locale);
|
2016-10-27 10:36:32 +02:00
|
|
|
|
|
|
|
ERR_EXPLAIN("Invalid Locale: "+trimmed_locale);
|
|
|
|
ERR_FAIL_COND(!is_valid_locale(trimmed_locale));
|
|
|
|
|
|
|
|
locale=trimmed_locale;
|
|
|
|
}
|
|
|
|
else {
|
2016-10-27 14:29:00 +02:00
|
|
|
locale=univ_locale;
|
2016-10-27 10:36:32 +02:00
|
|
|
}
|
2014-02-10 02:10:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void Translation::add_message( const StringName& p_src_text, const StringName& p_xlated_text ) {
|
|
|
|
|
|
|
|
translation_map[p_src_text]=p_xlated_text;
|
|
|
|
|
|
|
|
}
|
|
|
|
StringName Translation::get_message(const StringName& p_src_text) const {
|
|
|
|
|
|
|
|
const Map<StringName, StringName>::Element *E=translation_map.find(p_src_text);
|
|
|
|
if (!E)
|
|
|
|
return StringName();
|
|
|
|
|
|
|
|
return E->get();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Translation::erase_message(const StringName& p_src_text) {
|
|
|
|
|
|
|
|
translation_map.erase(p_src_text);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Translation::get_message_list(List<StringName> *r_messages) const {
|
|
|
|
|
|
|
|
for (const Map<StringName, StringName>::Element *E=translation_map.front();E;E=E->next()) {
|
|
|
|
|
|
|
|
r_messages->push_back(E->key());
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-08-02 03:10:38 +02:00
|
|
|
int Translation::get_message_count() const {
|
|
|
|
|
|
|
|
return translation_map.size();
|
|
|
|
};
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
void Translation::_bind_methods() {
|
|
|
|
|
2017-02-13 12:47:24 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("set_locale","locale"),&Translation::set_locale);
|
|
|
|
ClassDB::bind_method(D_METHOD("get_locale"),&Translation::get_locale);
|
|
|
|
ClassDB::bind_method(D_METHOD("add_message","src_message","xlated_message"),&Translation::add_message);
|
|
|
|
ClassDB::bind_method(D_METHOD("get_message","src_message"),&Translation::get_message);
|
|
|
|
ClassDB::bind_method(D_METHOD("erase_message","src_message"),&Translation::erase_message);
|
|
|
|
ClassDB::bind_method(D_METHOD("get_message_list"),&Translation::_get_message_list);
|
|
|
|
ClassDB::bind_method(D_METHOD("get_message_count"),&Translation::get_message_count);
|
|
|
|
ClassDB::bind_method(D_METHOD("_set_messages"),&Translation::_set_messages);
|
|
|
|
ClassDB::bind_method(D_METHOD("_get_messages"),&Translation::_get_messages);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-02-12 01:11:37 +01:00
|
|
|
ADD_PROPERTY( PropertyInfo(Variant::POOL_STRING_ARRAY,"messages",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR), "_set_messages", "_get_messages") ;
|
|
|
|
ADD_PROPERTY( PropertyInfo(Variant::STRING,"locale"), "set_locale", "get_locale") ;
|
2014-02-10 02:10:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Translation::Translation() {
|
|
|
|
|
|
|
|
locale="en";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
void TranslationServer::set_locale(const String& p_locale) {
|
|
|
|
|
2016-10-27 14:29:00 +02:00
|
|
|
// replaces '-' with '_' for macOS Sierra-style locales
|
|
|
|
String univ_locale = p_locale.replace("-", "_");
|
|
|
|
|
|
|
|
if(!is_valid_locale(univ_locale)) {
|
|
|
|
String trimmed_locale = get_trimmed_locale(univ_locale);
|
2016-10-27 10:36:32 +02:00
|
|
|
|
|
|
|
ERR_EXPLAIN("Invalid Locale: "+trimmed_locale);
|
|
|
|
ERR_FAIL_COND(!is_valid_locale(trimmed_locale));
|
|
|
|
|
|
|
|
locale=trimmed_locale;
|
|
|
|
}
|
|
|
|
else {
|
2016-10-27 14:29:00 +02:00
|
|
|
locale=univ_locale;
|
2016-10-27 10:36:32 +02:00
|
|
|
}
|
2017-01-09 20:43:44 +01:00
|
|
|
|
|
|
|
if (OS::get_singleton()->get_main_loop()) {
|
|
|
|
OS::get_singleton()->get_main_loop()->notification(MainLoop::NOTIFICATION_TRANSLATION_CHANGED);
|
|
|
|
}
|
2014-02-10 02:10:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
String TranslationServer::get_locale() const {
|
|
|
|
|
|
|
|
return locale;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void TranslationServer::add_translation(const Ref<Translation> &p_translation) {
|
|
|
|
|
|
|
|
translations.insert(p_translation);
|
|
|
|
|
|
|
|
}
|
|
|
|
void TranslationServer::remove_translation(const Ref<Translation> &p_translation) {
|
|
|
|
|
|
|
|
translations.erase(p_translation);
|
|
|
|
}
|
|
|
|
|
2014-08-02 03:10:38 +02:00
|
|
|
void TranslationServer::clear() {
|
|
|
|
|
|
|
|
translations.clear();
|
|
|
|
};
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
StringName TranslationServer::translate(const StringName& p_message) const {
|
|
|
|
|
|
|
|
//translate using locale
|
|
|
|
|
|
|
|
if (!enabled)
|
|
|
|
return p_message;
|
|
|
|
|
|
|
|
StringName res;
|
|
|
|
bool near_match=false;
|
|
|
|
const CharType *lptr=&locale[0];
|
|
|
|
|
|
|
|
|
|
|
|
for (const Set< Ref<Translation> >::Element *E=translations.front();E;E=E->next()) {
|
|
|
|
|
|
|
|
const Ref<Translation>& t = E->get();
|
|
|
|
String l = t->get_locale();
|
|
|
|
if (lptr[0]!=l[0] || lptr[1]!=l[1])
|
|
|
|
continue; // locale not match
|
|
|
|
|
|
|
|
//near match
|
2015-01-04 15:03:31 +01:00
|
|
|
bool match = (l!=locale);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
if (near_match && !match)
|
|
|
|
continue; //only near-match once
|
|
|
|
|
|
|
|
StringName r=t->get_message(p_message);
|
|
|
|
|
|
|
|
|
|
|
|
if (!r)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
res=r;
|
|
|
|
|
|
|
|
if (match)
|
|
|
|
break;
|
|
|
|
else
|
|
|
|
near_match=true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-01-04 15:03:31 +01:00
|
|
|
if (!res) {
|
|
|
|
//try again with fallback
|
|
|
|
if (fallback.length()>=2) {
|
|
|
|
|
|
|
|
const CharType *fptr=&fallback[0];
|
|
|
|
bool near_match=false;
|
|
|
|
for (const Set< Ref<Translation> >::Element *E=translations.front();E;E=E->next()) {
|
|
|
|
|
|
|
|
const Ref<Translation>& t = E->get();
|
|
|
|
String l = t->get_locale();
|
|
|
|
if (fptr[0]!=l[0] || fptr[1]!=l[1])
|
|
|
|
continue; // locale not match
|
|
|
|
|
|
|
|
//near match
|
|
|
|
bool match = (l!=fallback);
|
|
|
|
|
|
|
|
if (near_match && !match)
|
|
|
|
continue; //only near-match once
|
|
|
|
|
|
|
|
StringName r=t->get_message(p_message);
|
|
|
|
|
|
|
|
if (!r)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
res=r;
|
|
|
|
|
|
|
|
if (match)
|
|
|
|
break;
|
|
|
|
else
|
|
|
|
near_match=true;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
if (!res)
|
|
|
|
return p_message;
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
TranslationServer *TranslationServer::singleton=NULL;
|
|
|
|
|
|
|
|
bool TranslationServer::_load_translations(const String& p_from) {
|
|
|
|
|
2017-01-05 13:16:00 +01:00
|
|
|
if (GlobalConfig::get_singleton()->has(p_from)) {
|
2017-01-07 22:25:37 +01:00
|
|
|
PoolVector<String> translations=GlobalConfig::get_singleton()->get(p_from);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
int tcount=translations.size();
|
|
|
|
|
|
|
|
if (tcount) {
|
2017-01-07 22:25:37 +01:00
|
|
|
PoolVector<String>::Read r = translations.read();
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
for(int i=0;i<tcount;i++) {
|
|
|
|
|
2015-12-29 18:58:16 +01:00
|
|
|
//print_line( "Loading translation from " + r[i] );
|
2014-02-10 02:10:30 +01:00
|
|
|
Ref<Translation> tr = ResourceLoader::load(r[i]);
|
|
|
|
if (tr.is_valid())
|
|
|
|
add_translation(tr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void TranslationServer::setup() {
|
|
|
|
|
2015-01-04 15:03:31 +01:00
|
|
|
String test = GLOBAL_DEF("locale/test","");
|
|
|
|
test=test.strip_edges();
|
|
|
|
if (test!="")
|
|
|
|
set_locale( test );
|
|
|
|
else
|
|
|
|
set_locale( OS::get_singleton()->get_locale() );
|
|
|
|
fallback = GLOBAL_DEF("locale/fallback","en");
|
|
|
|
#ifdef TOOLS_ENABLED
|
|
|
|
|
|
|
|
{
|
|
|
|
String options="";
|
|
|
|
int idx=0;
|
|
|
|
while(locale_list[idx]) {
|
|
|
|
if (idx>0)
|
|
|
|
options+=", ";
|
|
|
|
options+=locale_list[idx];
|
|
|
|
idx++;
|
|
|
|
}
|
2017-01-05 13:16:00 +01:00
|
|
|
GlobalConfig::get_singleton()->set_custom_property_info("locale/fallback",PropertyInfo(Variant::STRING,"locale/fallback",PROPERTY_HINT_ENUM,options));
|
2015-01-04 15:03:31 +01:00
|
|
|
}
|
|
|
|
#endif
|
2014-02-10 02:10:30 +01:00
|
|
|
//load translations
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2016-05-04 03:25:37 +02:00
|
|
|
void TranslationServer::set_tool_translation(const Ref<Translation>& p_translation) {
|
|
|
|
tool_translation=p_translation;
|
|
|
|
}
|
|
|
|
|
|
|
|
StringName TranslationServer::tool_translate(const StringName& p_message) const {
|
|
|
|
|
|
|
|
if (tool_translation.is_valid()) {
|
2016-05-28 00:58:28 +02:00
|
|
|
StringName r = tool_translation->get_message(p_message);
|
|
|
|
|
|
|
|
if (r) {
|
2016-05-04 03:25:37 +02:00
|
|
|
return r;
|
2016-05-28 00:58:28 +02:00
|
|
|
}
|
2016-05-04 03:25:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return p_message;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
void TranslationServer::_bind_methods() {
|
|
|
|
|
2017-02-13 12:47:24 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("set_locale","locale"),&TranslationServer::set_locale);
|
|
|
|
ClassDB::bind_method(D_METHOD("get_locale"),&TranslationServer::get_locale);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-02-13 12:47:24 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("translate","message"),&TranslationServer::translate);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-02-13 12:47:24 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("add_translation","translation:Translation"),&TranslationServer::add_translation);
|
|
|
|
ClassDB::bind_method(D_METHOD("remove_translation","translation:Translation"),&TranslationServer::remove_translation);
|
2014-08-02 03:10:38 +02:00
|
|
|
|
2017-02-13 12:47:24 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("clear"),&TranslationServer::clear);
|
2014-08-02 03:10:38 +02:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void TranslationServer::load_translations() {
|
|
|
|
|
|
|
|
String locale = get_locale();
|
|
|
|
bool found = _load_translations("locale/translations"); //all
|
2015-01-04 15:03:31 +01:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
if (_load_translations("locale/translations_"+locale.substr(0,2)))
|
|
|
|
found=true;
|
|
|
|
if ( locale.substr(0,2) != locale ) {
|
|
|
|
if (_load_translations("locale/translations_"+locale))
|
|
|
|
found=true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
TranslationServer::TranslationServer() {
|
|
|
|
|
|
|
|
|
|
|
|
singleton=this;
|
|
|
|
locale="en";
|
|
|
|
enabled=true;
|
|
|
|
|
|
|
|
}
|