libzypp: zypp/LanguageCode.cc Source File

libzypp 17.38.5

LanguageCode.cc
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12#include <iostream>
13
14#include <zypp-core/base/Logger.h>
15#include <zypp-core/base/String.h>
16#include <zypp-core/base/Gettext.h>
17#include <zypp-core/base/Hash.h>
18
19#include <zypp/LanguageCode.h>
20
21using std::endl;
22
24namespace zypp
25{
27 namespace
28 {
30 struct CodeMaps
31 {
33 static CodeMaps & instance()
34 {
35 static CodeMaps _instance;
36 return _instance;
37 }
38
40 std::string name( IdString index_r )
41 {
42 Link link( getIndex( index_r ) );
43
44 std::string ret;
45 if ( link->second )
46 { ret = _(link->second); }
47 else
48 {
49 ret = _("Unknown language: ");
50 ret += "'";
51 ret += index_r.c_str();
52 ret += "'";
53 }
54 return ret;
55 }
56
57 private:
58 using CodeMap = std::unordered_map<std::string, const char *>;
59 using Link = CodeMap::const_iterator;
60
61 using IndexMap = std::unordered_map<IdString, Link>;
62
66 CodeMaps();
67
69 Link getIndex( IdString index_r )
70 {
71 auto it = _indexMap.find( index_r );
72 return( it != _indexMap.end()
73 ? it->second
74 : newIndex( index_r, index_r.asString() ) );
75 }
76
78 Link newIndex( IdString index_r, const std::string & code_r )
79 {
80 Link link = _codeMap.find( code_r );
81 if ( link != _codeMap.end() )
82 return (_indexMap[index_r] = link);
83
84 // not found: Remember a new code
85 CodeMap::value_type nval( code_r, nullptr );
86
87 if ( code_r.size() > 3 || code_r.size() < 2 )
88 WAR << "Malformed LanguageCode '" << code_r << "' (expect 2 or 3-letter)" << endl;
89
90 std::string lcode( str::toLower( code_r ) );
91 if ( lcode != code_r )
92 {
93 WAR << "Malformed LanguageCode '" << code_r << "' (not lower case)" << endl;
94 // but maybe we're lucky with the lower case code
95 // and find a language name.
96 link = _codeMap.find( lcode );
97 if ( link != _codeMap.end() )
98 {
99 nval.second = link->second;
100 }
101 }
102 MIL << "Remember LanguageCode '" << code_r << "': '" << (nval.second?nval.second:"Unknown language") << "'" << endl;
103 return (_indexMap[index_r] = _codeMap.insert( nval ).first);
104 }
105
106 private:
107 CodeMap _codeMap;
108 IndexMap _indexMap;
109 };
110 } // namespace
112
114 // class LanguageCode
116
117 const LanguageCode LanguageCode::noCode;
118 //const LanguageCode LanguageCode::enCode("en"); in Locale.cc as Locale::enCode depends on it
119
120 LanguageCode::LanguageCode()
121 {}
122
123 LanguageCode::LanguageCode( IdString str_r )
124 : _str( str_r )
125 {}
126
127 LanguageCode::LanguageCode( const std::string & str_r )
128 : _str( str_r )
129 {}
130
131 LanguageCode::LanguageCode( const char * str_r )
132 : _str( str_r )
133 {}
134
135 LanguageCode::~LanguageCode()
136 {}
137
138
139 std::string LanguageCode::name() const
140 { return CodeMaps::instance().name( _str ); }
141
143 namespace
144 {
145 CodeMaps::CodeMaps()
146 {
147 // Defined LanguageCode constants
148 _codeMap[""] = N_("No Code");
149
150 struct LangInit
151 {
152 const char *iso639_2;
153 const char *iso639_1;
154 const char *name;
155 };
156
157 // some languages have more than one iso639_2 code
158 // so there are items with duplicate names
159 const LangInit langInit[] = {
160 // language code: aar aa
161 { "aar", "aa", N_( "Afar" ) },
162 // language code: abk ab
163 { "abk", "ab", N_( "Abkhazian" ) },
164 // language code: ace
165 { "ace", NULL, N_( "Achinese" ) },
166 // language code: ach
167 { "ach", NULL, N_( "Acoli" ) },
168 // language code: ada
169 { "ada", NULL, N_( "Adangme" ) },
170 // language code: ady
171 { "ady", NULL, N_( "Adyghe" ) },
172 // language code: afa
173 { "afa", NULL, N_( "Afro-Asiatic (Other)" ) },
174 // language code: afh
175 { "afh", NULL, N_( "Afrihili" ) },
176 // language code: afr af
177 { "afr", "af", N_( "Afrikaans" ) },
178 // language code: ain
179 { "ain", NULL, N_( "Ainu" ) },
180 // language code: aka ak
181 { "aka", "ak", N_( "Akan" ) },
182 // language code: akk
183 { "akk", NULL, N_( "Akkadian" ) },
184 // language code: alb sqi sq
185 { "alb", "sq", N_( "Albanian" ) },
186 // language code: alb sqi sq
187 { "sqi", NULL, N_( "Albanian" ) },
188 // language code: ale
189 { "ale", NULL, N_( "Aleut" ) },
190 // language code: alg
191 { "alg", NULL, N_( "Algonquian Languages" ) },
192 // language code: alt
193 { "alt", NULL, N_( "Southern Altai" ) },
194 // language code: amh am
195 { "amh", "am", N_( "Amharic" ) },
196 // language code: ang
197 { "ang", NULL, N_( "English, Old (ca.450-1100)" ) },
198 // language code: apa
199 { "apa", NULL, N_( "Apache Languages" ) },
200 // language code: ara ar
201 { "ara", "ar", N_( "Arabic" ) },
202 // language code: arc
203 { "arc", NULL, N_( "Aramaic" ) },
204 // language code: arg an
205 { "arg", "an", N_( "Aragonese" ) },
206 // language code: arm hye hy
207 { "arm", "hy", N_( "Armenian" ) },
208 // language code: arm hye hy
209 { "hye", NULL, N_( "Armenian" ) },
210 // language code: arn
211 { "arn", NULL, N_( "Araucanian" ) },
212 // language code: arp
213 { "arp", NULL, N_( "Arapaho" ) },
214 // language code: art
215 { "art", NULL, N_( "Artificial (Other)" ) },
216 // language code: arw
217 { "arw", NULL, N_( "Arawak" ) },
218 // language code: asm as
219 { "asm", "as", N_( "Assamese" ) },
220 // language code: ast
221 { "ast", NULL, N_( "Asturian" ) },
222 // language code: ath
223 { "ath", NULL, N_( "Athapascan Languages" ) },
224 // language code: aus
225 { "aus", NULL, N_( "Australian Languages" ) },
226 // language code: ava av
227 { "ava", "av", N_( "Avaric" ) },
228 // language code: ave ae
229 { "ave", "ae", N_( "Avestan" ) },
230 // language code: awa
231 { "awa", NULL, N_( "Awadhi" ) },
232 // language code: aym ay
233 { "aym", "ay", N_( "Aymara" ) },
234 // language code: aze az
235 { "aze", "az", N_( "Azerbaijani" ) },
236 // language code: bad
237 { "bad", NULL, N_( "Banda" ) },
238 // language code: bai
239 { "bai", NULL, N_( "Bamileke Languages" ) },
240 // language code: bak ba
241 { "bak", "ba", N_( "Bashkir" ) },
242 // language code: bal
243 { "bal", NULL, N_( "Baluchi" ) },
244 // language code: bam bm
245 { "bam", "bm", N_( "Bambara" ) },
246 // language code: ban
247 { "ban", NULL, N_( "Balinese" ) },
248 // language code: baq eus eu
249 { "baq", "eu", N_( "Basque" ) },
250 // language code: baq eus eu
251 { "eus", NULL, N_( "Basque" ) },
252 // language code: bas
253 { "bas", NULL, N_( "Basa" ) },
254 // language code: bat
255 { "bat", NULL, N_( "Baltic (Other)" ) },
256 // language code: bej
257 { "bej", NULL, N_( "Beja" ) },
258 // language code: bel be
259 { "bel", "be", N_( "Belarusian" ) },
260 // language code: bem
261 { "bem", NULL, N_( "Bemba" ) },
262 // language code: ben bn
263 { "ben", "bn", N_( "Bengali" ) },
264 // language code: ber
265 { "ber", NULL, N_( "Berber (Other)" ) },
266 // language code: bho
267 { "bho", NULL, N_( "Bhojpuri" ) },
268 // language code: bih bh
269 { "bih", "bh", N_( "Bihari" ) },
270 // language code: bik
271 { "bik", NULL, N_( "Bikol" ) },
272 // language code: bin
273 { "bin", NULL, N_( "Bini" ) },
274 // language code: bis bi
275 { "bis", "bi", N_( "Bislama" ) },
276 // language code: bla
277 { "bla", NULL, N_( "Siksika" ) },
278 // language code: bnt
279 { "bnt", NULL, N_( "Bantu (Other)" ) },
280 // language code: bos bs
281 { "bos", "bs", N_( "Bosnian" ) },
282 // language code: bra
283 { "bra", NULL, N_( "Braj" ) },
284 // language code: bre br
285 { "bre", "br", N_( "Breton" ) },
286 // language code: btk
287 { "btk", NULL, N_( "Batak (Indonesia)" ) },
288 // language code: bua
289 { "bua", NULL, N_( "Buriat" ) },
290 // language code: bug
291 { "bug", NULL, N_( "Buginese" ) },
292 // language code: bul bg
293 { "bul", "bg", N_( "Bulgarian" ) },
294 // language code: bur mya my
295 { "bur", "my", N_( "Burmese" ) },
296 // language code: bur mya my
297 { "mya", NULL, N_( "Burmese" ) },
298 // language code: byn
299 { "byn", NULL, N_( "Blin" ) },
300 // language code: cad
301 { "cad", NULL, N_( "Caddo" ) },
302 // language code: cai
303 { "cai", NULL, N_( "Central American Indian (Other)" ) },
304 // language code: car
305 { "car", NULL, N_( "Carib" ) },
306 // language code: cat ca
307 { "cat", "ca", N_( "Catalan" ) },
308 // language code: cau
309 { "cau", NULL, N_( "Caucasian (Other)" ) },
310 // language code: ceb
311 { "ceb", NULL, N_( "Cebuano" ) },
312 // language code: cel
313 { "cel", NULL, N_( "Celtic (Other)" ) },
314 // language code: cha ch
315 { "cha", "ch", N_( "Chamorro" ) },
316 // language code: chb
317 { "chb", NULL, N_( "Chibcha" ) },
318 // language code: che ce
319 { "che", "ce", N_( "Chechen" ) },
320 // language code: chg
321 { "chg", NULL, N_( "Chagatai" ) },
322 // language code: chi zho zh
323 { "chi", "zh", N_( "Chinese" ) },
324 // language code: chi zho zh
325 { "zho", NULL, N_( "Chinese" ) },
326 // language code: chk
327 { "chk", NULL, N_( "Chuukese" ) },
328 // language code: chm
329 { "chm", NULL, N_( "Mari" ) },
330 // language code: chn
331 { "chn", NULL, N_( "Chinook Jargon" ) },
332 // language code: cho
333 { "cho", NULL, N_( "Choctaw" ) },
334 // language code: chp
335 { "chp", NULL, N_( "Chipewyan" ) },
336 // language code: chr
337 { "chr", NULL, N_( "Cherokee" ) },
338 // language code: chu cu
339 { "chu", "cu", N_( "Church Slavic" ) },
340 // language code: chv cv
341 { "chv", "cv", N_( "Chuvash" ) },
342 // language code: chy
343 { "chy", NULL, N_( "Cheyenne" ) },
344 // language code: cmc
345 { "cmc", NULL, N_( "Chamic Languages" ) },
346 // language code: cop
347 { "cop", NULL, N_( "Coptic" ) },
348 // language code: cor kw
349 { "cor", "kw", N_( "Cornish" ) },
350 // language code: cos co
351 { "cos", "co", N_( "Corsican" ) },
352 // language code: cpe
353 { "cpe", NULL, N_( "Creoles and Pidgins, English-Based (Other)" ) },
354 // language code: cpf
355 { "cpf", NULL, N_( "Creoles and Pidgins, French-Based (Other)" ) },
356 // language code: cpp
357 { "cpp", NULL, N_( "Creoles and Pidgins, Portuguese-Based (Other)" ) },
358 // language code: cre cr
359 { "cre", "cr", N_( "Cree" ) },
360 // language code: crh
361 { "crh", NULL, N_( "Crimean Tatar" ) },
362 // language code: crp
363 { "crp", NULL, N_( "Creoles and Pidgins (Other)" ) },
364 // language code: csb
365 { "csb", NULL, N_( "Kashubian" ) },
366 // language code: cus
367 { "cus", NULL, N_( "Cushitic (Other)" ) },
368 // language code: cze ces cs
369 { "cze", "cs", N_( "Czech" ) },
370 // language code: cze ces cs
371 { "ces", NULL, N_( "Czech" ) },
372 // language code: dak
373 { "dak", NULL, N_( "Dakota" ) },
374 // language code: dan da
375 { "dan", "da", N_( "Danish" ) },
376 // language code: dar
377 { "dar", NULL, N_( "Dargwa" ) },
378 // language code: day
379 { "day", NULL, N_( "Dayak" ) },
380 // language code: del
381 { "del", NULL, N_( "Delaware" ) },
382 // language code: den
383 { "den", NULL, N_( "Slave (Athapascan)" ) },
384 // language code: dgr
385 { "dgr", NULL, N_( "Dogrib" ) },
386 // language code: din
387 { "din", NULL, N_( "Dinka" ) },
388 // language code: div dv
389 { "div", "dv", N_( "Divehi" ) },
390 // language code: doi
391 { "doi", NULL, N_( "Dogri" ) },
392 // language code: dra
393 { "dra", NULL, N_( "Dravidian (Other)" ) },
394 // language code: dsb
395 { "dsb", NULL, N_( "Lower Sorbian" ) },
396 // language code: dua
397 { "dua", NULL, N_( "Duala" ) },
398 // language code: dum
399 { "dum", NULL, N_( "Dutch, Middle (ca.1050-1350)" ) },
400 // language code: dut nld nl
401 { "dut", "nl", N_( "Dutch" ) },
402 // language code: dut nld nl
403 { "nld", NULL, N_( "Dutch" ) },
404 // language code: dyu
405 { "dyu", NULL, N_( "Dyula" ) },
406 // language code: dzo dz
407 { "dzo", "dz", N_( "Dzongkha" ) },
408 // language code: efi
409 { "efi", NULL, N_( "Efik" ) },
410 // language code: egy
411 { "egy", NULL, N_( "Egyptian (Ancient)" ) },
412 // language code: eka
413 { "eka", NULL, N_( "Ekajuk" ) },
414 // language code: elx
415 { "elx", NULL, N_( "Elamite" ) },
416 // language code: eng en
417 { "eng", "en", N_( "English" ) },
418 // language code: enm
419 { "enm", NULL, N_( "English, Middle (1100-1500)" ) },
420 // language code: epo eo
421 { "epo", "eo", N_( "Esperanto" ) },
422 // language code: est et
423 { "est", "et", N_( "Estonian" ) },
424 // language code: ewe ee
425 { "ewe", "ee", N_( "Ewe" ) },
426 // language code: ewo
427 { "ewo", NULL, N_( "Ewondo" ) },
428 // language code: fan
429 { "fan", NULL, N_( "Fang" ) },
430 // language code: fao fo
431 { "fao", "fo", N_( "Faroese" ) },
432 // language code: fat
433 { "fat", NULL, N_( "Fanti" ) },
434 // language code: fij fj
435 { "fij", "fj", N_( "Fijian" ) },
436 // language code: fil
437 { "fil", NULL, N_( "Filipino" ) },
438 // language code: fin fi
439 { "fin", "fi", N_( "Finnish" ) },
440 // language code: fiu
441 { "fiu", NULL, N_( "Finno-Ugrian (Other)" ) },
442 // language code: fon
443 { "fon", NULL, N_( "Fon" ) },
444 // language code: fre fra fr
445 { "fre", "fr", N_( "French" ) },
446 // language code: fre fra fr
447 { "fra", NULL, N_( "French" ) },
448 // language code: frm
449 { "frm", NULL, N_( "French, Middle (ca.1400-1600)" ) },
450 // language code: fro
451 { "fro", NULL, N_( "French, Old (842-ca.1400)" ) },
452 // language code: fry fy
453 { "fry", "fy", N_( "Frisian" ) },
454 // language code: ful ff
455 { "ful", "ff", N_( "Fulah" ) },
456 // language code: fur
457 { "fur", NULL, N_( "Friulian" ) },
458 // language code: gaa
459 { "gaa", NULL, N_( "Ga" ) },
460 // language code: gay
461 { "gay", NULL, N_( "Gayo" ) },
462 // language code: gba
463 { "gba", NULL, N_( "Gbaya" ) },
464 // language code: gem
465 { "gem", NULL, N_( "Germanic (Other)" ) },
466 // language code: geo kat ka
467 { "geo", "ka", N_( "Georgian" ) },
468 // language code: geo kat ka
469 { "kat", NULL, N_( "Georgian" ) },
470 // language code: ger deu de
471 { "ger", "de", N_( "German" ) },
472 // language code: ger deu de
473 { "deu", NULL, N_( "German" ) },
474 // language code: gez
475 { "gez", NULL, N_( "Geez" ) },
476 // language code: gil
477 { "gil", NULL, N_( "Gilbertese" ) },
478 // language code: gla gd
479 { "gla", "gd", N_( "Gaelic" ) },
480 // language code: gle ga
481 { "gle", "ga", N_( "Irish" ) },
482 // language code: glg gl
483 { "glg", "gl", N_( "Galician" ) },
484 // language code: glv gv
485 { "glv", "gv", N_( "Manx" ) },
486 // language code: gmh
487 { "gmh", NULL, N_( "German, Middle High (ca.1050-1500)" ) },
488 // language code: goh
489 { "goh", NULL, N_( "German, Old High (ca.750-1050)" ) },
490 // language code: gon
491 { "gon", NULL, N_( "Gondi" ) },
492 // language code: gor
493 { "gor", NULL, N_( "Gorontalo" ) },
494 // language code: got
495 { "got", NULL, N_( "Gothic" ) },
496 // language code: grb
497 { "grb", NULL, N_( "Grebo" ) },
498 // language code: grc
499 { "grc", NULL, N_( "Greek, Ancient (to 1453)" ) },
500 // language code: gre ell el
501 { "gre", "el", N_( "Greek, Modern (1453-)" ) },
502 // language code: gre ell el
503 { "ell", NULL, N_( "Greek, Modern (1453-)" ) },
504 // language code: grn gn
505 { "grn", "gn", N_( "Guarani" ) },
506 // language code: guj gu
507 { "guj", "gu", N_( "Gujarati" ) },
508 // language code: gwi
509 { "gwi", NULL, N_( "Gwich'in" ) },
510 // language code: hai
511 { "hai", NULL, N_( "Haida" ) },
512 // language code: hat ht
513 { "hat", "ht", N_( "Haitian" ) },
514 // language code: hau ha
515 { "hau", "ha", N_( "Hausa" ) },
516 // language code: haw
517 { "haw", NULL, N_( "Hawaiian" ) },
518 // language code: heb he
519 { "heb", "he", N_( "Hebrew" ) },
520 // language code: her hz
521 { "her", "hz", N_( "Herero" ) },
522 // language code: hil
523 { "hil", NULL, N_( "Hiligaynon" ) },
524 // language code: him
525 { "him", NULL, N_( "Himachali" ) },
526 // language code: hin hi
527 { "hin", "hi", N_( "Hindi" ) },
528 // language code: hit
529 { "hit", NULL, N_( "Hittite" ) },
530 // language code: hmn
531 { "hmn", NULL, N_( "Hmong" ) },
532 // language code: hmo ho
533 { "hmo", "ho", N_( "Hiri Motu" ) },
534 // language code: hsb
535 { "hsb", NULL, N_( "Upper Sorbian" ) },
536 // language code: hun hu
537 { "hun", "hu", N_( "Hungarian" ) },
538 // language code: hup
539 { "hup", NULL, N_( "Hupa" ) },
540 // language code: iba
541 { "iba", NULL, N_( "Iban" ) },
542 // language code: ibo ig
543 { "ibo", "ig", N_( "Igbo" ) },
544 // language code: ice isl is
545 { "ice", "is", N_( "Icelandic" ) },
546 // language code: ice isl is
547 { "isl", NULL, N_( "Icelandic" ) },
548 // language code: ido io
549 { "ido", "io", N_( "Ido" ) },
550 // language code: iii ii
551 { "iii", "ii", N_( "Sichuan Yi" ) },
552 // language code: ijo
553 { "ijo", NULL, N_( "Ijo" ) },
554 // language code: iku iu
555 { "iku", "iu", N_( "Inuktitut" ) },
556 // language code: ile ie
557 { "ile", "ie", N_( "Interlingue" ) },
558 // language code: ilo
559 { "ilo", NULL, N_( "Iloko" ) },
560 // language code: ina ia
561 { "ina", "ia", N_( "Interlingua (International Auxiliary Language Association)" ) },
562 // language code: inc
563 { "inc", NULL, N_( "Indic (Other)" ) },
564 // language code: ind id
565 { "ind", "id", N_( "Indonesian" ) },
566 // language code: ine
567 { "ine", NULL, N_( "Indo-European (Other)" ) },
568 // language code: inh
569 { "inh", NULL, N_( "Ingush" ) },
570 // language code: ipk ik
571 { "ipk", "ik", N_( "Inupiaq" ) },
572 // language code: ira
573 { "ira", NULL, N_( "Iranian (Other)" ) },
574 // language code: iro
575 { "iro", NULL, N_( "Iroquoian Languages" ) },
576 // language code: ita it
577 { "ita", "it", N_( "Italian" ) },
578 // language code: jav jv
579 { "jav", "jv", N_( "Javanese" ) },
580 // language code: jbo
581 { "jbo", NULL, N_( "Lojban" ) },
582 // language code: jpn ja
583 { "jpn", "ja", N_( "Japanese" ) },
584 // language code: jpr
585 { "jpr", NULL, N_( "Judeo-Persian" ) },
586 // language code: jrb
587 { "jrb", NULL, N_( "Judeo-Arabic" ) },
588 // language code: kaa
589 { "kaa", NULL, N_( "Kara-Kalpak" ) },
590 // language code: kab
591 { "kab", NULL, N_( "Kabyle" ) },
592 // language code: kac
593 { "kac", NULL, N_( "Kachin" ) },
594 // language code: kal kl
595 { "kal", "kl", N_( "Kalaallisut" ) },
596 // language code: kam
597 { "kam", NULL, N_( "Kamba" ) },
598 // language code: kan kn
599 { "kan", "kn", N_( "Kannada" ) },
600 // language code: kar
601 { "kar", NULL, N_( "Karen" ) },
602 // language code: kas ks
603 { "kas", "ks", N_( "Kashmiri" ) },
604 // language code: kau kr
605 { "kau", "kr", N_( "Kanuri" ) },
606 // language code: kaw
607 { "kaw", NULL, N_( "Kawi" ) },
608 // language code: kaz kk
609 { "kaz", "kk", N_( "Kazakh" ) },
610 // language code: kbd
611 { "kbd", NULL, N_( "Kabardian" ) },
612 // language code: kha
613 { "kha", NULL, N_( "Khasi" ) },
614 // language code: khi
615 { "khi", NULL, N_( "Khoisan (Other)" ) },
616 // language code: khm km
617 { "khm", "km", N_( "Khmer" ) },
618 // language code: kho
619 { "kho", NULL, N_( "Khotanese" ) },
620 // language code: kik ki
621 { "kik", "ki", N_( "Kikuyu" ) },
622 // language code: kin rw
623 { "kin", "rw", N_( "Kinyarwanda" ) },
624 // language code: kir ky
625 { "kir", "ky", N_( "Kirghiz" ) },
626 // language code: kmb
627 { "kmb", NULL, N_( "Kimbundu" ) },
628 // language code: kok
629 { "kok", NULL, N_( "Konkani" ) },
630 // language code: kom kv
631 { "kom", "kv", N_( "Komi" ) },
632 // language code: kon kg
633 { "kon", "kg", N_( "Kongo" ) },
634 // language code: kor ko
635 { "kor", "ko", N_( "Korean" ) },
636 // language code: kos
637 { "kos", NULL, N_( "Kosraean" ) },
638 // language code: kpe
639 { "kpe", NULL, N_( "Kpelle" ) },
640 // language code: krc
641 { "krc", NULL, N_( "Karachay-Balkar" ) },
642 // language code: kro
643 { "kro", NULL, N_( "Kru" ) },
644 // language code: kru
645 { "kru", NULL, N_( "Kurukh" ) },
646 // language code: kua kj
647 { "kua", "kj", N_( "Kuanyama" ) },
648 // language code: kum
649 { "kum", NULL, N_( "Kumyk" ) },
650 // language code: kur ku
651 { "kur", "ku", N_( "Kurdish" ) },
652 // language code: kut
653 { "kut", NULL, N_( "Kutenai" ) },
654 // language code: lad
655 { "lad", NULL, N_( "Ladino" ) },
656 // language code: lah
657 { "lah", NULL, N_( "Lahnda" ) },
658 // language code: lam
659 { "lam", NULL, N_( "Lamba" ) },
660 // language code: lao lo
661 { "lao", "lo", N_( "Lao" ) },
662 // language code: lat la
663 { "lat", "la", N_( "Latin" ) },
664 // language code: lav lv
665 { "lav", "lv", N_( "Latvian" ) },
666 // language code: lez
667 { "lez", NULL, N_( "Lezghian" ) },
668 // language code: lim li
669 { "lim", "li", N_( "Limburgan" ) },
670 // language code: lin ln
671 { "lin", "ln", N_( "Lingala" ) },
672 // language code: lit lt
673 { "lit", "lt", N_( "Lithuanian" ) },
674 // language code: lol
675 { "lol", NULL, N_( "Mongo" ) },
676 // language code: loz
677 { "loz", NULL, N_( "Lozi" ) },
678 // language code: ltz lb
679 { "ltz", "lb", N_( "Luxembourgish" ) },
680 // language code: lua
681 { "lua", NULL, N_( "Luba-Lulua" ) },
682 // language code: lub lu
683 { "lub", "lu", N_( "Luba-Katanga" ) },
684 // language code: lug lg
685 { "lug", "lg", N_( "Ganda" ) },
686 // language code: lui
687 { "lui", NULL, N_( "Luiseno" ) },
688 // language code: lun
689 { "lun", NULL, N_( "Lunda" ) },
690 // language code: luo
691 { "luo", NULL, N_( "Luo (Kenya and Tanzania)" ) },
692 // language code: lus
693 { "lus", NULL, N_( "Lushai" ) },
694 // language code: mac mkd mk
695 { "mac", "mk", N_( "Macedonian" ) },
696 // language code: mac mkd mk
697 { "mkd", NULL, N_( "Macedonian" ) },
698 // language code: mad
699 { "mad", NULL, N_( "Madurese" ) },
700 // language code: mag
701 { "mag", NULL, N_( "Magahi" ) },
702 // language code: mah mh
703 { "mah", "mh", N_( "Marshallese" ) },
704 // language code: mai
705 { "mai", NULL, N_( "Maithili" ) },
706 // language code: mak
707 { "mak", NULL, N_( "Makasar" ) },
708 // language code: mal ml
709 { "mal", "ml", N_( "Malayalam" ) },
710 // language code: man
711 { "man", NULL, N_( "Mandingo" ) },
712 // language code: mao mri mi
713 { "mao", "mi", N_( "Maori" ) },
714 // language code: mao mri mi
715 { "mri", NULL, N_( "Maori" ) },
716 // language code: map
717 { "map", NULL, N_( "Austronesian (Other)" ) },
718 // language code: mar mr
719 { "mar", "mr", N_( "Marathi" ) },
720 // language code: mas
721 { "mas", NULL, N_( "Masai" ) },
722 // language code: may msa ms
723 { "may", "ms", N_( "Malay" ) },
724 // language code: may msa ms
725 { "msa", NULL, N_( "Malay" ) },
726 // language code: mdf
727 { "mdf", NULL, N_( "Moksha" ) },
728 // language code: mdr
729 { "mdr", NULL, N_( "Mandar" ) },
730 // language code: men
731 { "men", NULL, N_( "Mende" ) },
732 // language code: mga
733 { "mga", NULL, N_( "Irish, Middle (900-1200)" ) },
734 // language code: mic
735 { "mic", NULL, N_( "Mi'kmaq" ) },
736 // language code: min
737 { "min", NULL, N_( "Minangkabau" ) },
738 // language code: mis
739 { "mis", NULL, N_( "Miscellaneous Languages" ) },
740 // language code: mkh
741 { "mkh", NULL, N_( "Mon-Khmer (Other)" ) },
742 // language code: mlg mg
743 { "mlg", "mg", N_( "Malagasy" ) },
744 // language code: mlt mt
745 { "mlt", "mt", N_( "Maltese" ) },
746 // language code: mnc
747 { "mnc", NULL, N_( "Manchu" ) },
748 // language code: mni
749 { "mni", NULL, N_( "Manipuri" ) },
750 // language code: mno
751 { "mno", NULL, N_( "Manobo Languages" ) },
752 // language code: moh
753 { "moh", NULL, N_( "Mohawk" ) },
754 // language code: mol mo
755 { "mol", "mo", N_( "Moldavian" ) },
756 // language code: mon mn
757 { "mon", "mn", N_( "Mongolian" ) },
758 // language code: mos
759 { "mos", NULL, N_( "Mossi" ) },
760 // language code: mul
761 { "mul", NULL, N_( "Multiple Languages" ) },
762 // language code: mun
763 { "mun", NULL, N_( "Munda languages" ) },
764 // language code: mus
765 { "mus", NULL, N_( "Creek" ) },
766 // language code: mwl
767 { "mwl", NULL, N_( "Mirandese" ) },
768 // language code: mwr
769 { "mwr", NULL, N_( "Marwari" ) },
770 // language code: myn
771 { "myn", NULL, N_( "Mayan Languages" ) },
772 // language code: myv
773 { "myv", NULL, N_( "Erzya" ) },
774 // language code: nah
775 { "nah", NULL, N_( "Nahuatl" ) },
776 // language code: nai
777 { "nai", NULL, N_( "North American Indian" ) },
778 // language code: nap
779 { "nap", NULL, N_( "Neapolitan" ) },
780 // language code: nau na
781 { "nau", "na", N_( "Nauru" ) },
782 // language code: nav nv
783 { "nav", "nv", N_( "Navajo" ) },
784 // language code: nbl nr
785 { "nbl", "nr", N_( "Ndebele, South" ) },
786 // language code: nde nd
787 { "nde", "nd", N_( "Ndebele, North" ) },
788 // language code: ndo ng
789 { "ndo", "ng", N_( "Ndonga" ) },
790 // language code: nds
791 { "nds", NULL, N_( "Low German" ) },
792 // language code: nep ne
793 { "nep", "ne", N_( "Nepali" ) },
794 // language code: new
795 { "new", NULL, N_( "Nepal Bhasa" ) },
796 // language code: nia
797 { "nia", NULL, N_( "Nias" ) },
798 // language code: nic
799 { "nic", NULL, N_( "Niger-Kordofanian (Other)" ) },
800 // language code: niu
801 { "niu", NULL, N_( "Niuean" ) },
802 // language code: nno nn
803 { "nno", "nn", N_( "Norwegian Nynorsk" ) },
804 // language code: nob nb
805 { "nob", "nb", N_( "Norwegian Bokmal" ) },
806 // language code: nog
807 { "nog", NULL, N_( "Nogai" ) },
808 // language code: non
809 { "non", NULL, N_( "Norse, Old" ) },
810 // language code: nor no
811 { "nor", "no", N_( "Norwegian" ) },
812 // language code: nso
813 { "nso", NULL, N_( "Northern Sotho" ) },
814 // language code: nub
815 { "nub", NULL, N_( "Nubian Languages" ) },
816 // language code: nwc
817 { "nwc", NULL, N_( "Classical Newari" ) },
818 // language code: nya ny
819 { "nya", "ny", N_( "Chichewa" ) },
820 // language code: nym
821 { "nym", NULL, N_( "Nyamwezi" ) },
822 // language code: nyn
823 { "nyn", NULL, N_( "Nyankole" ) },
824 // language code: nyo
825 { "nyo", NULL, N_( "Nyoro" ) },
826 // language code: nzi
827 { "nzi", NULL, N_( "Nzima" ) },
828 // language code: oci oc
829 { "oci", "oc", N_( "Occitan (post 1500)" ) },
830 // language code: oji oj
831 { "oji", "oj", N_( "Ojibwa" ) },
832 // language code: ori or
833 { "ori", "or", N_( "Oriya" ) },
834 // language code: orm om
835 { "orm", "om", N_( "Oromo" ) },
836 // language code: osa
837 { "osa", NULL, N_( "Osage" ) },
838 // language code: oss os
839 { "oss", "os", N_( "Ossetian" ) },
840 // language code: ota
841 { "ota", NULL, N_( "Turkish, Ottoman (1500-1928)" ) },
842 // language code: oto
843 { "oto", NULL, N_( "Otomian Languages" ) },
844 // language code: paa
845 { "paa", NULL, N_( "Papuan (Other)" ) },
846 // language code: pag
847 { "pag", NULL, N_( "Pangasinan" ) },
848 // language code: pal
849 { "pal", NULL, N_( "Pahlavi" ) },
850 // language code: pam
851 { "pam", NULL, N_( "Pampanga" ) },
852 // language code: pan pa
853 { "pan", "pa", N_( "Panjabi" ) },
854 // language code: pap
855 { "pap", NULL, N_( "Papiamento" ) },
856 // language code: pau
857 { "pau", NULL, N_( "Palauan" ) },
858 // language code: peo
859 { "peo", NULL, N_( "Persian, Old (ca.600-400 B.C.)" ) },
860 // language code: per fas fa
861 { "per", "fa", N_( "Persian" ) },
862 // language code: per fas fa
863 { "fas", NULL, N_( "Persian" ) },
864 // language code: phi
865 { "phi", NULL, N_( "Philippine (Other)" ) },
866 // language code: phn
867 { "phn", NULL, N_( "Phoenician" ) },
868 // language code: pli pi
869 { "pli", "pi", N_( "Pali" ) },
870 // language code: pol pl
871 { "pol", "pl", N_( "Polish" ) },
872 // language code: pon
873 { "pon", NULL, N_( "Pohnpeian" ) },
874 // language code: por pt
875 { "por", "pt", N_( "Portuguese" ) },
876 // language code: pra
877 { "pra", NULL, N_( "Prakrit Languages" ) },
878 // language code: pro
879 { "pro", NULL, N_( "Provencal, Old (to 1500)" ) },
880 // language code: pus ps
881 { "pus", "ps", N_( "Pushto" ) },
882 // language code: que qu
883 { "que", "qu", N_( "Quechua" ) },
884 // language code: raj
885 { "raj", NULL, N_( "Rajasthani" ) },
886 // language code: rap
887 { "rap", NULL, N_( "Rapanui" ) },
888 // language code: rar
889 { "rar", NULL, N_( "Rarotongan" ) },
890 // language code: roa
891 { "roa", NULL, N_( "Romance (Other)" ) },
892 // language code: roh rm
893 { "roh", "rm", N_( "Raeto-Romance" ) },
894 // language code: rom
895 { "rom", NULL, N_( "Romany" ) },
896 // language code: rum ron ro
897 { "rum", "ro", N_( "Romanian" ) },
898 // language code: rum ron ro
899 { "ron", NULL, N_( "Romanian" ) },
900 // language code: run rn
901 { "run", "rn", N_( "Rundi" ) },
902 // language code: rus ru
903 { "rus", "ru", N_( "Russian" ) },
904 // language code: sad
905 { "sad", NULL, N_( "Sandawe" ) },
906 // language code: sag sg
907 { "sag", "sg", N_( "Sango" ) },
908 // language code: sah
909 { "sah", NULL, N_( "Yakut" ) },
910 // language code: sai
911 { "sai", NULL, N_( "South American Indian (Other)" ) },
912 // language code: sal
913 { "sal", NULL, N_( "Salishan Languages" ) },
914 // language code: sam
915 { "sam", NULL, N_( "Samaritan Aramaic" ) },
916 // language code: san sa
917 { "san", "sa", N_( "Sanskrit" ) },
918 // language code: sas
919 { "sas", NULL, N_( "Sasak" ) },
920 // language code: sat
921 { "sat", NULL, N_( "Santali" ) },
922 // language code: scc srp sr
923 { "scc", "sr", N_( "Serbian" ) },
924 // language code: scc srp sr
925 { "srp", NULL, N_( "Serbian" ) },
926 // language code: scn
927 { "scn", NULL, N_( "Sicilian" ) },
928 // language code: sco
929 { "sco", NULL, N_( "Scots" ) },
930 // language code: scr hrv hr
931 { "scr", "hr", N_( "Croatian" ) },
932 // language code: scr hrv hr
933 { "hrv", NULL, N_( "Croatian" ) },
934 // language code: sel
935 { "sel", NULL, N_( "Selkup" ) },
936 // language code: sem
937 { "sem", NULL, N_( "Semitic (Other)" ) },
938 // language code: sga
939 { "sga", NULL, N_( "Irish, Old (to 900)" ) },
940 // language code: sgn
941 { "sgn", NULL, N_( "Sign Languages" ) },
942 // language code: shn
943 { "shn", NULL, N_( "Shan" ) },
944 // language code: sid
945 { "sid", NULL, N_( "Sidamo" ) },
946 // language code: sin si
947 { "sin", "si", N_( "Sinhala" ) },
948 // language code: sio
949 { "sio", NULL, N_( "Siouan Languages" ) },
950 // language code: sit
951 { "sit", NULL, N_( "Sino-Tibetan (Other)" ) },
952 // language code: sla
953 { "sla", NULL, N_( "Slavic (Other)" ) },
954 // language code: slo slk sk
955 { "slo", "sk", N_( "Slovak" ) },
956 // language code: slo slk sk
957 { "slk", NULL, N_( "Slovak" ) },
958 // language code: slv sl
959 { "slv", "sl", N_( "Slovenian" ) },
960 // language code: sma
961 { "sma", NULL, N_( "Southern Sami" ) },
962 // language code: sme se
963 { "sme", "se", N_( "Northern Sami" ) },
964 // language code: smi
965 { "smi", NULL, N_( "Sami Languages (Other)" ) },
966 // language code: smj
967 { "smj", NULL, N_( "Lule Sami" ) },
968 // language code: smn
969 { "smn", NULL, N_( "Inari Sami" ) },
970 // language code: smo sm
971 { "smo", "sm", N_( "Samoan" ) },
972 // language code: sms
973 { "sms", NULL, N_( "Skolt Sami" ) },
974 // language code: sna sn
975 { "sna", "sn", N_( "Shona" ) },
976 // language code: snd sd
977 { "snd", "sd", N_( "Sindhi" ) },
978 // language code: snk
979 { "snk", NULL, N_( "Soninke" ) },
980 // language code: sog
981 { "sog", NULL, N_( "Sogdian" ) },
982 // language code: som so
983 { "som", "so", N_( "Somali" ) },
984 // language code: son
985 { "son", NULL, N_( "Songhai" ) },
986 // language code: sot st
987 { "sot", "st", N_( "Sotho, Southern" ) },
988 // language code: spa es
989 { "spa", "es", N_( "Spanish" ) },
990 // language code: srd sc
991 { "srd", "sc", N_( "Sardinian" ) },
992 // language code: srr
993 { "srr", NULL, N_( "Serer" ) },
994 // language code: ssa
995 { "ssa", NULL, N_( "Nilo-Saharan (Other)" ) },
996 // language code: ssw ss
997 { "ssw", "ss", N_( "Swati" ) },
998 // language code: suk
999 { "suk", NULL, N_( "Sukuma" ) },
1000 // language code: sun su
1001 { "sun", "su", N_( "Sundanese" ) },
1002 // language code: sus
1003 { "sus", NULL, N_( "Susu" ) },
1004 // language code: sux
1005 { "sux", NULL, N_( "Sumerian" ) },
1006 // language code: swa sw
1007 { "swa", "sw", N_( "Swahili" ) },
1008 // language code: swe sv
1009 { "swe", "sv", N_( "Swedish" ) },
1010 // language code: syr
1011 { "syr", NULL, N_( "Syriac" ) },
1012 // language code: tah ty
1013 { "tah", "ty", N_( "Tahitian" ) },
1014 // language code: tai
1015 { "tai", NULL, N_( "Tai (Other)" ) },
1016 // language code: tam ta
1017 { "tam", "ta", N_( "Tamil" ) },
1018 // language code: tat tt
1019 { "tat", "tt", N_( "Tatar" ) },
1020 // language code: tel te
1021 { "tel", "te", N_( "Telugu" ) },
1022 // language code: tem
1023 { "tem", NULL, N_( "Timne" ) },
1024 // language code: ter
1025 { "ter", NULL, N_( "Tereno" ) },
1026 // language code: tet
1027 { "tet", NULL, N_( "Tetum" ) },
1028 // language code: tgk tg
1029 { "tgk", "tg", N_( "Tajik" ) },
1030 // language code: tgl tl
1031 { "tgl", "tl", N_( "Tagalog" ) },
1032 // language code: tha th
1033 { "tha", "th", N_( "Thai" ) },
1034 // language code: tib bod bo
1035 { "tib", "bo", N_( "Tibetan" ) },
1036 // language code: tib bod bo
1037 { "bod", NULL, N_( "Tibetan" ) },
1038 // language code: tig
1039 { "tig", NULL, N_( "Tigre" ) },
1040 // language code: tir ti
1041 { "tir", "ti", N_( "Tigrinya" ) },
1042 // language code: tiv
1043 { "tiv", NULL, N_( "Tiv" ) },
1044 // language code: tkl
1045 { "tkl", NULL, N_( "Tokelau" ) },
1046 // language code: tlh
1047 { "tlh", NULL, N_( "Klingon" ) },
1048 // language code: tli
1049 { "tli", NULL, N_( "Tlingit" ) },
1050 // language code: tmh
1051 { "tmh", NULL, N_( "Tamashek" ) },
1052 // language code: tog
1053 { "tog", NULL, N_( "Tonga (Nyasa)" ) },
1054 // language code: ton to
1055 { "ton", "to", N_( "Tonga (Tonga Islands)" ) },
1056 // language code: tpi
1057 { "tpi", NULL, N_( "Tok Pisin" ) },
1058 // language code: tsi
1059 { "tsi", NULL, N_( "Tsimshian" ) },
1060 // language code: tsn tn
1061 { "tsn", "tn", N_( "Tswana" ) },
1062 // language code: tso ts
1063 { "tso", "ts", N_( "Tsonga" ) },
1064 // language code: tuk tk
1065 { "tuk", "tk", N_( "Turkmen" ) },
1066 // language code: tum
1067 { "tum", NULL, N_( "Tumbuka" ) },
1068 // language code: tup
1069 { "tup", NULL, N_( "Tupi Languages" ) },
1070 // language code: tur tr
1071 { "tur", "tr", N_( "Turkish" ) },
1072 // language code: tut
1073 { "tut", NULL, N_( "Altaic (Other)" ) },
1074 // language code: tvl
1075 { "tvl", NULL, N_( "Tuvalu" ) },
1076 // language code: twi tw
1077 { "twi", "tw", N_( "Twi" ) },
1078 // language code: tyv
1079 { "tyv", NULL, N_( "Tuvinian" ) },
1080 // language code: udm
1081 { "udm", NULL, N_( "Udmurt" ) },
1082 // language code: uga
1083 { "uga", NULL, N_( "Ugaritic" ) },
1084 // language code: uig ug
1085 { "uig", "ug", N_( "Uighur" ) },
1086 // language code: ukr uk
1087 { "ukr", "uk", N_( "Ukrainian" ) },
1088 // language code: umb
1089 { "umb", NULL, N_( "Umbundu" ) },
1090 // language code: und
1091 { "und", NULL, N_( "Undetermined" ) },
1092 // language code: urd ur
1093 { "urd", "ur", N_( "Urdu" ) },
1094 // language code: uzb uz
1095 { "uzb", "uz", N_( "Uzbek" ) },
1096 // language code: vai
1097 { "vai", NULL, N_( "Vai" ) },
1098 // language code: ven ve
1099 { "ven", "ve", N_( "Venda" ) },
1100 // language code: vie vi
1101 { "vie", "vi", N_( "Vietnamese" ) },
1102 // language code: vol vo
1103 { "vol", "vo", N_( "Volapuk" ) },
1104 // language code: vot
1105 { "vot", NULL, N_( "Votic" ) },
1106 // language code: wak
1107 { "wak", NULL, N_( "Wakashan Languages" ) },
1108 // language code: wal
1109 { "wal", NULL, N_( "Walamo" ) },
1110 // language code: war
1111 { "war", NULL, N_( "Waray" ) },
1112 // language code: was
1113 { "was", NULL, N_( "Washo" ) },
1114 // language code: wel cym cy
1115 { "wel", "cy", N_( "Welsh" ) },
1116 // language code: wel cym cy
1117 { "cym", NULL, N_( "Welsh" ) },
1118 // language code: wen
1119 { "wen", NULL, N_( "Sorbian Languages" ) },
1120 // language code: wln wa
1121 { "wln", "wa", N_( "Walloon" ) },
1122 // language code: wol wo
1123 { "wol", "wo", N_( "Wolof" ) },
1124 // language code: xal
1125 { "xal", NULL, N_( "Kalmyk" ) },
1126 // language code: xho xh
1127 { "xho", "xh", N_( "Xhosa" ) },
1128 // language code: yao
1129 { "yao", NULL, N_( "Yao" ) },
1130 // language code: yap
1131 { "yap", NULL, N_( "Yapese" ) },
1132 // language code: yid yi
1133 { "yid", "yi", N_( "Yiddish" ) },
1134 // language code: yor yo
1135 { "yor", "yo", N_( "Yoruba" ) },
1136 // language code: ypk
1137 { "ypk", NULL, N_( "Yupik Languages" ) },
1138 // language code: zap
1139 { "zap", NULL, N_( "Zapotec" ) },
1140 // language code: zen
1141 { "zen", NULL, N_( "Zenaga" ) },
1142 // language code: zha za
1143 { "zha", "za", N_( "Zhuang" ) },
1144 // language code: znd
1145 { "znd", NULL, N_( "Zande" ) },
1146 // language code: zul zu
1147 { "zul", "zu", N_( "Zulu" ) },
1148 // language code: zun
1149 { "zun", NULL, N_( "Zuni" ) },
1150
1151 { NULL, NULL, NULL }
1152 };
1153
1154 for (const LangInit * i = langInit; i->iso639_2 != NULL; ++i)
1155 {
1156 const char * name( i->name );
1157 _codeMap[i->iso639_2] = name;
1158 if (i->iso639_1 != NULL)
1159 _codeMap[i->iso639_1] = name;
1160 }
1161 }
1162 } // namespace
1164} // namespace zypp
Gettext.h
N_
#define N_(MSG)
Definition Gettext.h:36
_
#define _(MSG)
Definition Gettext.h:39
Hash.h
LanguageCode.h
Logger.h
MIL
#define MIL
Definition Logger.h:100
WAR
#define WAR
Definition Logger.h:101
String.h
zypp::IdString
Access to the sat-pools string space.
Definition IdString.h:44
zypp::LanguageCode
Language codes (iso639_2/iso639_1).
Definition LanguageCode.h:31
zypp::LanguageCode::name
std::string name() const
Return the translated language name; if unknown the language code.
Definition LanguageCode.cc:139
zypp::LanguageCode::noCode
static const LanguageCode noCode
Empty code.
Definition LanguageCode.h:52
zypp::LanguageCode::LanguageCode
LanguageCode()
Default Ctor: noCode.
Definition LanguageCode.cc:120
zypp::LanguageCode::_str
IdString _str
Definition LanguageCode.h:67
zypp::LanguageCode::~LanguageCode
~LanguageCode()
Dtor.
Definition LanguageCode.cc:135
zypp::str::toLower
std::string toLower(const std::string &s)
Return lowercase version of s.
Definition String.cc:180
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition CodePitfalls.doc:2
zypp::CodeMaps::CodeMaps
CodeMaps()
Ctor initializes the code maps.
Definition Locale.cc:134
zypp::CodeMaps::getIndex
const LC & getIndex(IdString index_r)
Return LC for index_r, creating it if necessary.
Definition Locale.cc:140
zypp::CodeMaps::name
std::string name(IdString index_r)
Definition Locale.cc:78
zypp::CodeMaps::instance
static CodeMaps & instance()
The singleton.
Definition Locale.cc:66