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