Update localized language names and use tsv file for them

This commit is contained in:
Benau 2021-11-15 10:58:48 +08:00
parent d064f8d96e
commit 33e6110737
4 changed files with 154 additions and 262 deletions

133
data/localized_name.tsv Normal file
View File

@ -0,0 +1,133 @@
language_code language_name
aa ʿAfár af
af Afrikaans
am ኣማርኛ
ar العربية
as অসমীয়া
ast Asturianu
ay Aymar aru
az Azərbaycanca
be Беларуская мова
bg български
bn বাংলা
bo བོད་སྐད་
br Brezhoneg
bs Bosanski
ca Català
co Corsu
cs Čeština
cs_CZ Čeština (Česká Republika)
cy Welsh
cy_GB Welsh (Great Britain)
da Dansk
da_DK Dansk (Danmark)
de Deutsch
de_AT Deutsch (Österreich)
de_CH Deutsch (Schweiz)
de_DE Deutsch (Deutschland)
dz རྫོང་ཁ
el ελληνικά
en English
en_AU English (Australia)
en_CA English (Canada)
en_GB English (Great Britain)
en_US English (United States)
en_ZA English (South Africa)
eo Esperanto
es Español
et Eesti keel
eu Euskara
fa فارسى
fi Suomi
fo Føroyskt
fr Français
fr_CA Français (Canada)
fr_CH Français (Suisse)
fr_FR Français (France)
fr_LU Français (Luxembourg)
fy Frysk
ga Gaeilge
gd Gàidhlig
gl Galego
gn Avañe'ẽ
gu ગુજરાતી
gv Gaelg
ha حَوْسَ
he עברית
hi हिन्दी
hr Hrvatski
hu Magyar
hy Հայերեն
ia Interlingua
id Bahasa Indonesia
is Íslenska
it Italiano
iu ᐃᓄᒃᑎᑐᑦ/inuktitut
ja 日本語
ka ქართული
kk Қазақша
kl Kalaallisut
km ភាសាខ្មែរ
kn ಕನ್ನಡ
ko 한국어
krl Karjalan kieli
ku Kurdî
kw Kernowek
ky кыргызча
la Latina
lo ລາວ
lt Lietuvių
lv Latviešu
jbo La .lojban.
mg Malagasy
mi Māori
mk Македонски
ml മലയാളം
mn Монгол
mn_MN Монгол
mr मराठी
ms Bahasa Melayu
mt Malti
my မြန်မာဘာသာ
nb Norsk Bokmål
nl Nederlands
nn Norsk Nynorsk
no Norsk Bokmål
oc Occitan
om Oromoo
or ଓଡ଼ିଆ
os ирон ӕвзаг
pa ਪੰਜਾਬੀ
pl Polski
pms Piemontèis
ps پښتو
pt Português
pt_BR Português Brasileiro
qu Runa Simi
rm Rumantsch
ro Română
ru Русский
rw Kinyarwanda
sc Sardu
sco Scots
se Sámegiella
sk Slovenčina
sl Slovenščina
sq Shqip
sr Српски
sv Svenska
sw Kiswahili
szl Ślůnsko
ta தமிழ்
th ไทย
tr Türkçe
tt Татарча
uk Українська
ur اردو
uz Oʻzbek tili
vi Tiếng Việt
yi ייִדיש
zh 中文
zh_CN 中文(简体)
zh_HK 中文(香港)
zh_TW 中文(繁體)
1 language_code language_name
2 aa ʿAfár af
3 af Afrikaans
4 am ኣማርኛ
5 ar العربية
6 as অসমীয়া
7 ast Asturianu
8 ay Aymar aru
9 az Azərbaycanca
10 be Беларуская мова
11 bg български
12 bn বাংলা
13 bo བོད་སྐད་
14 br Brezhoneg
15 bs Bosanski
16 ca Català
17 co Corsu
18 cs Čeština
19 cs_CZ Čeština (Česká Republika)
20 cy Welsh
21 cy_GB Welsh (Great Britain)
22 da Dansk
23 da_DK Dansk (Danmark)
24 de Deutsch
25 de_AT Deutsch (Österreich)
26 de_CH Deutsch (Schweiz)
27 de_DE Deutsch (Deutschland)
28 dz རྫོང་ཁ
29 el ελληνικά
30 en English
31 en_AU English (Australia)
32 en_CA English (Canada)
33 en_GB English (Great Britain)
34 en_US English (United States)
35 en_ZA English (South Africa)
36 eo Esperanto
37 es Español
38 et Eesti keel
39 eu Euskara
40 fa فارسى
41 fi Suomi
42 fo Føroyskt
43 fr Français
44 fr_CA Français (Canada)
45 fr_CH Français (Suisse)
46 fr_FR Français (France)
47 fr_LU Français (Luxembourg)
48 fy Frysk
49 ga Gaeilge
50 gd Gàidhlig
51 gl Galego
52 gn Avañe'ẽ
53 gu ગુજરાતી
54 gv Gaelg
55 ha حَوْسَ
56 he עברית
57 hi हिन्दी
58 hr Hrvatski
59 hu Magyar
60 hy Հայերեն
61 ia Interlingua
62 id Bahasa Indonesia
63 is Íslenska
64 it Italiano
65 iu ᐃᓄᒃᑎᑐᑦ/inuktitut
66 ja 日本語
67 ka ქართული
68 kk Қазақша
69 kl Kalaallisut
70 km ភាសាខ្មែរ
71 kn ಕನ್ನಡ
72 ko 한국어
73 krl Karjalan kieli
74 ku Kurdî
75 kw Kernowek
76 ky кыргызча
77 la Latina
78 lo ລາວ
79 lt Lietuvių
80 lv Latviešu
81 jbo La .lojban.
82 mg Malagasy
83 mi Māori
84 mk Македонски
85 ml മലയാളം
86 mn Монгол
87 mn_MN Монгол
88 mr मराठी
89 ms Bahasa Melayu
90 mt Malti
91 my မြန်မာဘာသာ
92 nb Norsk Bokmål
93 nl Nederlands
94 nn Norsk Nynorsk
95 no Norsk Bokmål
96 oc Occitan
97 om Oromoo
98 or ଓଡ଼ିଆ
99 os ирон ӕвзаг
100 pa ਪੰਜਾਬੀ
101 pl Polski
102 pms Piemontèis
103 ps پښتو
104 pt Português
105 pt_BR Português Brasileiro
106 qu Runa Simi
107 rm Rumantsch
108 ro Română
109 ru Русский
110 rw Kinyarwanda
111 sc Sardu
112 sco Scots
113 se Sámegiella
114 sk Slovenčina
115 sl Slovenščina
116 sq Shqip
117 sr Српски
118 sv Svenska
119 sw Kiswahili
120 szl Ślůnsko
121 ta தமிழ்
122 th ไทย
123 tr Türkçe
124 tt Татарча
125 uk Українська
126 ur اردو
127 uz Oʻzbek tili
128 vi Tiếng Việt
129 yi ייִדיש
130 zh 中文
131 zh_CN 中文(简体)
132 zh_HK 中文(香港)
133 zh_TW 中文(繁體)

View File

@ -1,237 +0,0 @@
aa=ʿAfár af;
af=Afrikaans;
af_ZA=0;
am=ኣማርኛ;
ar=العربية;
ar_AR=0;
ar_OM=0;
ar_SA=0;
ar_SY=0;
ar_TN=0;
as=অসমীয়া;
ast=Asturianu;
ay=Aymar aru;
az=Azərbaycanca;
az_IR=0;
be=Беларуская мова;
bg=български;
bg_BG=0;
bn=বাংলা;
bn_BD=0;
bn_IN=0;
bo=བོད་སྐད་;
br=Brezhoneg;
bs=Bosanski;
bs_BA=0;
bs_BS=0;
ca_ES=0;
ca=0;
cmn=0;
co=Corsu;
cs=Čeština;
cs_CZ=Čeština (Česká Republika);
cy=Welsh;
cy_GB=Welsh (Great Britain);
cz=Unknown language;
da=Dansk;
da_DK=Dansk (Danmark);
de=Deutsch;
de_AT=Deutsch (Österreich);
de_CH=Deutsch (Schweiz);
de_DE=Deutsch (Deutschland);
dk=Unknown language;
dz=རྫོང་ཁ;
el=ελληνικά;
el_GR=0;
en=English;
en_AU=English (Australia);
en_CA=English (Canada);
en_GB=English (Great Britain);
en_US=English (United States);
en_ZA=English (South Africa);
en_US=English;
eo=Esperanto;
es=Español;
es_AR=0;
es_CL=0;
es_CO=0;
es_CR=0;
es_DO=0;
es_EC=0;
es_ES=0;
es_GT=0;
es_HN=0;
es_LA=0;
es_MX=0;
es_NI=0;
es_PA=0;
es_PE=0;
es_PR=0;
es_SV=0;
es_UY=0;
es_VE=0;
et=Eesti keel;
et_EE=0;
et_ET=0;
eu=Euskara;
eu_ES=0;
fa=فارسى;
fa_AF=0;
fa_IR=0;
fi=Suomi;
fi_FI=0;
fo=Føroyskt;
fo_FO=0;
fr=Français;
fr_CA=Français (Canada);
fr_CH=Français (Suisse);
fr_FR=Français (France);
fr_LU=Français (Luxembourg);
fy=Frysk;
ga=Gaeilge;
gd=Gàidhlig;
gl=Galego;
gl_ES=0;
gn=Avañe'ẽ;
gu=ગુજરાતી;
gv=Gaelg;
ha=حَوْسَ;
he=עברית;
he_IL=0;
hi=हिन्दी;
hr=Hrvatski;
hr_HR=0;
hu=Magyar;
hu_HU=0;
hy=Հայերեն;
ia=Interlingua;
id=Bahasa Indonesia;
id_ID=0;
is=Íslenska;
is_IS=0;
it=Italiano;
it_CH=0;
it_IT=0;
iu=ᐃᓄᒃᑎᑐᑦ/inuktitut;
ja=日本語;
ja_JP=0;
ka=ქართული;
kk=Қазақша;
kl=Kalaallisut;
km=ភាសាខ្មែរ;
km_KH=0;
kn=ಕನ್ನಡ;
ko=한국어;
ko_KR=0;
krl=Karjalan kieli;
ku=Kurdî;
kw=Kernowek;
ky=кыргызча;
la=Latina;
lo=ລາວ;
lt=Lietuvių;
lt=0;
lv=Latviešu;
lv_LV=0;
jbo=La .lojban.;
mg=Malagasy;
mi=Māori;
mk=Македонски;
mk_MK=0;
ml=മലയാളം;
mn=Монгол;
mn_MN=Монгол;
mr=मराठी;
ms=Bahasa Melayu;
ms_MY=0;
mt=Malti;
my=မြန်မာဘာသာ;
my_MM=0;
nb=0;
nb_NO=0;
ne=0;
nl=Nederlands;
nl_BE=0;
nl_NL=0;
nn=Norsk nynorsk;
nn_NO=0;
no=Norsk bokmål;
no_NO=0;
no_NY=0;
nr=0;
oc=Occitan;
om=Oromoo;
or=ଓଡ଼ିଆ;
os=0;
pa=ਪੰਜਾਬੀ;
pl=Polski;
pl_PL=0;
pms=Piemontèis;
ps=پښتو;
pt=Português;
pt_BR=0;
pt_PT=0;
qu=Runa Simi;
rm=Rumantsch;
ro=Română;
ro_RO=0;
ru=Русский;
ru_RU=0;
rw=Kinyarwanda;
sa=0;
sc=Sardu;
sco=0;
sd=0;
se=Sámegiella;
se_NO=0;
si=0;
sk=Slovenčina;
sk_SK=0;
sl=Slovenščina;
sl_SI=0;
sl_SL=0;
sm=0;
so=0;
sp=0;
sq=Shqip;
sq_AL=0;
sr=Српски;
sr_YU=0;
ss=0;
st=0;
sv=Svenska;
sv_SE=0;
sv_SV=0;
sw=Kiswahili;
szl=Ślůnsko;
ta=தமிழ்;
te=0;
tg=0;
th=ไทย;
th_TH=0;
ti=0;
tk=0;
tl=0;
to=0;
tr=Türkçe;
tr_TR=0;
ts=0;
tt=Татарча;
ug=0;
uk=Українська;
uk_UA=0;
ur=اردو;
ur_PK=0;
uz=0;
vi=Tiếng Việt;
vi_VN=0;
wa=0;
wo=0;
xh=0;
yi=ייִדיש;
yo=0;
zh=中文;
zh_CN=中文(简体);
zh_HK=中文(香港);
zh_TW=中文(繁體);
zu=0;

View File

@ -160,7 +160,7 @@ Translations::Translations() //: m_dictionary_manager("UTF-16")
if (m_localized_name.empty()) if (m_localized_name.empty())
{ {
const std::string file_name = file_manager->getAsset("localized_name.txt"); const std::string file_name = file_manager->getAsset("localized_name.tsv");
try try
{ {
std::ifstream in(FileUtils::getPortableReadingPath(file_name)); std::ifstream in(FileUtils::getPortableReadingPath(file_name));
@ -171,30 +171,25 @@ Translations::Translations() //: m_dictionary_manager("UTF-16")
} }
else else
{ {
for (std::string line; std::getline(in, line, ';'); ) std::string line;
while (!StringUtils::safeGetline(in, line).eof())
{ {
line = StringUtils::removeWhitespaces(line); std::vector<std::string> lists = StringUtils::split(line, '\t');
if (lists.size() != 2)
if (line.empty())
continue;
std::size_t pos = line.find("=");
if (pos == std::string::npos)
continue;
std::string name = line.substr(0, pos);
std::string localized_name = line.substr(pos + 1);
if (name.empty() || localized_name.empty())
continue;
if (localized_name == "0")
{ {
localized_name = Log::error("translation", "Invaild list.");
tinygettext::Language::from_name(name).get_name(); break;
} }
m_localized_name[name] = localized_name; if (lists[0] == "language_code")
{
continue;
}
if (lists[1] == "0")
{
lists[1] =
tinygettext::Language::from_name(lists[0]).get_name();
}
m_localized_name[lists[0]] = lists[1];
} }
} }
} }
@ -695,10 +690,11 @@ std::string Translations::getCurrentLanguageNameCode()
} // getCurrentLanguageNameCode } // getCurrentLanguageNameCode
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
const std::string& Translations::getLocalizedName(const std::string& str) const const std::string Translations::getLocalizedName(const std::string& str) const
{ {
std::map<std::string, std::string>::const_iterator n = m_localized_name.find(str); std::map<std::string, std::string>::const_iterator n = m_localized_name.find(str);
assert (n != m_localized_name.end()); if (n == m_localized_name.end())
return tinygettext::Language::from_name(str).get_name();
return n->second; return n->second;
} // getLocalizedName } // getLocalizedName

View File

@ -87,7 +87,7 @@ public:
std::string getCurrentLanguageNameCode(); std::string getCurrentLanguageNameCode();
const std::string& getLocalizedName(const std::string& str) const; const std::string getLocalizedName(const std::string& str) const;
irr::core::stringw getLocalizedCountryName(const std::string& country_code) const; irr::core::stringw getLocalizedCountryName(const std::string& country_code) const;