[Supertux-Commit] [tinygettext commit] r140 - in branches/tinygettext-portable: . src

codesite-noreply at google.com codesite-noreply at google.com
Mon Feb 2 01:05:25 PST 2009


Author: grumbel
Date: Mon Feb  2 01:03:45 2009
New Revision: 140

Added:
    branches/tinygettext-portable/src/plural_forms.cpp   (contents, props  
changed)
    branches/tinygettext-portable/src/plural_forms.hpp   (contents, props  
changed)
Modified:
    branches/tinygettext-portable/TODO
    branches/tinygettext-portable/src/SConscript
    branches/tinygettext-portable/src/dictionary.hpp
    branches/tinygettext-portable/src/language.cpp
    branches/tinygettext-portable/src/language.hpp
    branches/tinygettext-portable/src/po_parser.cpp

Log:
Removed Plural-Forms from Language, moved Plural-Forms into seperate file

Modified: branches/tinygettext-portable/TODO
==============================================================================
--- branches/tinygettext-portable/TODO	(original)
+++ branches/tinygettext-portable/TODO	Mon Feb  2 01:03:45 2009
@@ -24,6 +24,8 @@
  tinygettext API related stuff:
  ==============================

+* warn if po contains a msgid_plural but no PluralForms
+
  * Language matching needs a little review/cleanup

  * translate, translate_ctxt, translate_ctxt_plural, ... could be

Modified: branches/tinygettext-portable/src/SConscript
==============================================================================
--- branches/tinygettext-portable/src/SConscript	(original)
+++ branches/tinygettext-portable/src/SConscript	Mon Feb  2 01:03:45 2009
@@ -5,6 +5,7 @@
  env.StaticLibrary('tinygettext',
                    ['tinygettext.cpp',
                     'language.cpp',
+                   'plural_forms.cpp',
                     'dictionary.cpp',
                     'dictionary_manager.cpp',
                     'directory.cpp',

Modified: branches/tinygettext-portable/src/dictionary.hpp
==============================================================================
--- branches/tinygettext-portable/src/dictionary.hpp	(original)
+++ branches/tinygettext-portable/src/dictionary.hpp	Mon Feb  2 01:03:45  
2009
@@ -24,6 +24,7 @@
  #include <vector>
  #include <string>
  #include "language.hpp"
+#include "plural_forms.hpp"

  namespace tinygettext {


Modified: branches/tinygettext-portable/src/language.cpp
==============================================================================
--- branches/tinygettext-portable/src/language.cpp	(original)
+++ branches/tinygettext-portable/src/language.cpp	Mon Feb  2 01:03:45 2009
@@ -23,63 +23,6 @@

  namespace tinygettext {
  
-/**
- *  Plural functions are used to select a string that matches a given
- *  count. \a n is the count and the return value is the string index
- *  used in the .po file, for example:
- *
- *   msgstr[0] = "You got %d error";
- *   msgstr[1] = "You got %d errors";
- *          ^-- return value of plural function
- */
-unsigned int plural1(int )     { return 0; }
-unsigned int plural2_1(int n)  { return (n != 1); }
-unsigned int plural2_2(int n)  { return (n > 1); }
-unsigned int plural2_mk(int n) { return n==1 || n%10==1 ? 0 : 1; }
-unsigned int plural3_lv(int n) { return (n%10==1 && n%100!=11 ? 0 : n !=  
0 ? 1 : 2); }
-unsigned int plural3_ga(int n) { return n==1 ? 0 : n==2 ? 1 : 2; }
-unsigned int plural3_lt(int n) { return (n%10==1 && n%100!=11 ? 0 :  
n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2); }
-unsigned int plural3_1(int n)  { return (n%10==1 && n%100!=11 ? 0 :  
n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2); }
-unsigned int plural3_sk(int n) { return (n==1) ? 0 : (n>=2 && n<=4) ? 1 :  
2; }
-unsigned int plural3_pl(int n) { return (n==1 ? 0 : n%10>=2 && n%10<=4 &&  
(n%100<10 || n%100>=20) ? 1 : 2); }
-unsigned int plural3_sl(int n) { return (n%100==1 ? 0 : n%100==2 ? 1 :  
n%100==3 || n%100==4 ? 2 : 3); }
-unsigned int plural4_ar(int n) { return n==1 ? 0 : n==2 ? 1 : n>=3 &&  
n<=10 ? 2 : 3; }
-
-PluralForms
-PluralForms::from_string(const std::string& str)
-{
-  static std::map<std::string, struct PluralForms> plural_forms;
-
-  if (plural_forms.empty())
-    {
-      // FIXME: Could match some more strings if we cut out all spaces  
before compare
-      plural_forms["Plural-Forms: nplurals=1; plural=0;"]        =  
PluralForms::create(1, plural1);
-      plural_forms["Plural-Forms: nplurals=2; plural=(n != 1);"] =  
PluralForms::create(2, plural2_1);
-      plural_forms["Plural-Forms: nplurals=2; plural=(n > 1);"]  =  
PluralForms::create(2, plural2_2);
-      plural_forms["Plural-Forms: nplurals=2; plural=n==1 || n%10==1 ? 0 :  
1;"] = PluralForms::create(2, plural2_mk);
-
-      plural_forms["Plural-Forms: nplurals=3; plural=n%10==1 &&  
n%100!=11 ? 0 : n != 0 ? 1 : 2);"] = PluralForms::create(2, plural3_lv);
-      plural_forms["Plural-Forms: nplurals=3; plural=n==1 ? 0 : n==2 ? 1 :  
2;"] = PluralForms::create(3, plural3_ga);
-      plural_forms["Plural-Forms: nplurals=3; plural=(n%10==1 &&  
n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2);"] =  
PluralForms::create(3, plural3_lt);
-      plural_forms["Plural-Forms: nplurals=3; plural=(n%10==1 &&  
n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);"] =  
PluralForms::create(3, plural3_1);
-      plural_forms["Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 &&  
n<=4) ? 1 : 2;"] = PluralForms::create(3, plural3_sk);
-      plural_forms["Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2  
&& n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);"] = PluralForms::create(3,  
plural3_pl);
-      plural_forms["Plural-Forms: nplurals=3; plural=(n%100==1 ? 0 :  
n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);"] = PluralForms::create(3,  
plural3_sl);
-
-      plural_forms["Plural-Forms: nplurals=4; plural=n==1 ? 0 : n==2 ? 1 :  
n>=3 && n<=10 ? 2 : 3;"] = PluralForms::create(4, plural4_ar);
-  }
-
-  std::map<std::string, struct PluralForms>::const_iterator i=  
plural_forms.find(str);
-  if (i != plural_forms.end())
-    {
-      return i->second;
-    }
-  else
-    {
-      return PluralForms::create(0, 0);
-    }
-}
-
  struct LanguageSpec {
    /** Language code: "de", "en", ... */
    const char* language;
@@ -92,251 +35,248 @@

    /** Language name: "German", "English", "French", ... */
    const char* name;
-
-  PluralForms plural_form;
  };
  
  /** Language Definitions */
  //*{
-// FIXME: entries marked with 'unknown' have unknown plural forms
-//LanguageSpec lang_en at boldquot("en at boldquot", 0, 0, "Unknown language")
-//LanguageSpec lang_en at quot("en at quot", 0, 0, "Unknown language")
-//LanguageSpec lang_en_US at piglatin("en_US at piglatin", 0, 0, "Unknown  
language",   2, plural2_1);    // "nplurals=2; plural=(n != 1);"
  LanguageSpec languages[] = {
-  { "aa", 0,    0, "Afar",                          { 2, plural2_1 }  },    
// unknown
-  { "af", 0,    0, "Afrikaans",                     { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "af", "ZA", 0, "Afrikaans (South Africa)",      { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "am", 0,    0, "Amharic",                       { 2, plural2_1 }  },    
// unknown
-  { "ar", 0,    0, "Arabic",                        { 4, plural4_ar } },    
// "nplurals=4; plural=n==1 ? 0 : n==2 ? 1 : n>=3 && n<=10 ? 2 : 3"
-  { "ar", "AR", 0, "Arabic (Argentina)",            { 4, plural4_ar } },    
// "nplurals=4; plural=n==1 ? 0 : n==2 ? 1 : n>=3 && n<=10 ? 2 : 3"
-  { "ar", "OM", 0, "Arabic (Oman)",                 { 4, plural4_ar } },    
// "nplurals=4; plural=n==1 ? 0 : n==2 ? 1 : n>=3 && n<=10 ? 2 : 3"
-  { "ar", "SA", 0, "Arabic (Saudi Arabia)",         { 4, plural4_ar } },    
// "nplurals=4; plural=n==1 ? 0 : n==2 ? 1 : n>=3 && n<=10 ? 2 : 3"
-  { "ar", "SY", 0, "Arabic (Syrian Arab Republic)", { 4, plural4_ar } },    
// "nplurals=4; plural=n==1 ? 0 : n==2 ? 1 : n>=3 && n<=10 ? 2 : 3"
-  { "ar", "TN", 0, "Arabic (Tunisia)",              { 4, plural4_ar } },    
// "nplurals=4; plural=n==1 ? 0 : n==2 ? 1 : n>=3 && n<=10 ? 2 : 3"
-  { "as", 0,    0, "Assamese",                      { 2, plural2_1 }  },    
// unknown
-  { "ast",0,    0, "Asturian",                      { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "ay", 0,    0, "Aymara",                        { 2, plural2_1 }  },    
// unknown
-  { "az", 0,    0, "Azerbaijani",                   { 1, plural1 }    },    
// "nplurals=1; plural=0;"
-  { "az", "IR", 0, "Azerbaijani (Iran)",            { 1, plural1 }    },    
// "nplurals=1; plural=0;"
-  { "be", 0,    0, "Belarusian",                    { 3, plural3_1 }  },    
// "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 &&  
(n%100<10 || n%100>=20) ? 1 : 2);"
-  { "be", 0, "latin", "Belarusian",                 { 3, plural3_1 }  },    
// "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 &&  
(n%100<10 || n%100>=20) ? 1 : 2);"
-  { "bg", 0,    0, "Bulgarian",                     { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "bg", "BG", 0, "Bulgarian (Bulgaria)",          { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "bn", 0,    0, "Bengali",                       { 2, plural2_1 }  },    
// unknown
-  { "bn", "BD", 0, "Bengali (Bangladesh)",          { 2, plural2_1 }  },    
// unknown
-  { "bn", "IN", 0, "Bengali (India)",               { 2, plural2_1 }  },    
// unknown
-  { "bo", 0,    0, "Tibetan",                       { 2, plural2_1 }  },    
// unknown
-  { "br", 0,    0, "Breton",                        { 2, plural2_1 }  },    
// unknown
-  { "bs", 0,    0, "Bosnian",                       { 3, plural3_1 }  },    
// "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 &&  
(n%100<10 || n%100>=20) ? 1 : 2);"
-  { "bs", "BA", 0, "Bosnian (Bosnia/Herzegovina)",  { 3, plural3_1 }  },    
// "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 &&  
(n%100<10 || n%100>=20) ? 1 : 2);"
-  { "bs", "BS", 0, "Bosnian (Bahamas)",             { 3, plural3_1 }  },    
// "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 &&  
(n%100<10 || n%100>=20) ? 1 : 2);"
-  { "ca", "ES", "valencia", "Catalan (valencia)",   { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "ca", "ES", 0, "Catalan (Spain)",               { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "ca", 0,    "valencia", "Catalan (valencia)",   { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "ca", 0,    0, "Catalan",                       { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "co", 0,    0, "Corsican",                      { 2, plural2_1 }  },    
// unknown
-  { "cs", 0,    0, "Czech",                         { 3, plural3_1 }  },    
// "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 &&  
(n%100<10 || n%100>=20) ? 1 : 2);"
-  { "cs", "CZ", 0, "Czech (Czech Republic)",        { 3, plural3_1 }  },    
// "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 &&  
(n%100<10 || n%100>=20) ? 1 : 2);"
-  { "cy", 0,    0, "Welsh",                         { 2, plural2_1 }  },    
// unknown
-  { "cy", "GB", 0, "Welsh (Great Britain)",         { 2, plural2_1 }  },    
// unknown
-  { "cz", 0,    0, "Unknown language",              { 2, plural2_1 }  },    
// unknown
-  { "da", 0,    0, "Danish",                        { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "da", "DK", 0, "Danish (Denmark)",              { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "de", 0,    0, "German",                        { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "de", "AT", 0, "German (Austria)",              { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "de", "CH", 0, "German (Switzerland)",          { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "de", "DE", 0, "German (Germany)",              { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "dk", 0,    0, "Unknown language",              { 2, plural2_1 }  },    
// unknown
-  { "dz", 0,    0, "Dzongkha",                      { 2, plural2_1 }  },    
// unknown
-  { "el", 0,    0, "Greek",                         { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "el", "GR",  0, "Greek (Greece)",               { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "en", 0,    0, "English",                       { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "en", "AU", 0, "English (Australia)" ,          { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "en", "CA", 0, "English (Canada)",              { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "en", "GB", 0, "English (Great Britain)",       { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "en", "US", 0, "English (United States)",       { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "en", "ZA", 0, "English (South Africa)",        { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "eo", 0,    0, "Esperanto",                     { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "es", 0,    0, "Spanish",                       { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "es", "AR", 0, "Spanish (Argentina)",           { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "es", "CL", 0, "Spanish (Chile)",               { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "es", "CO", 0, "Spanish (Colombia)",            { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "es", "CR", 0, "Spanish (Costa Rica)",          { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "es", "DO", 0, "Spanish (Dominican Republic)",  { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "es", "EC", 0, "Spanish (Ecuador)",             { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "es", "ES", 0, "Spanish (Spain)",               { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "es", "GT", 0, "Spanish (Guatemala)",           { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "es", "HN", 0, "Spanish (Honduras)",            { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "es", "LA", 0, "Spanish (Laos)",                { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "es", "MX", 0, "Spanish (Mexico)",              { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "es", "NI", 0, "Spanish (Nicaragua)",           { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "es", "PA", 0, "Spanish (Panama)",              { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "es", "PE", 0, "Spanish (Peru)",                { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "es", "PR", 0, "Spanish (Puerto Rico)",         { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "es", "SV", 0, "Spanish (El Salvador)",         { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "es", "UY", 0, "Spanish (Uruguay)",             { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "es", "VE", 0, "Spanish (Venezuela)",           { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "et", 0,    0, "Estonian",                      { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "et", "EE", 0, "Estonian (Estonia)",            { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "et", "ET", 0, "Estonian (Ethiopia)",           { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "eu", 0,    0, "Basque",                        { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "eu", "ES", 0, "Basque (Spain)",                { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "fa", 0,    0, "Persian",                       { 1, plural1 }    },    
// "nplurals=1; plural=0;"
-  { "fa", "AF", 0, "Persian (Afghanistan)",         { 1, plural1 }    },    
// "nplurals=1; plural=0;"
-  { "fa", "IR", 0, "Persian (Iran)",                { 1, plural1 }    },    
// "nplurals=1; plural=0;"
-  { "fi", 0,    0, "Finnish",                       { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "fi", "FI", 0, "Finnish (Finland)",             { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "fo", 0,    0, "Faroese",                       { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "fo", "FO", 0, "Faeroese (Faroe Islands)",      { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "fr", 0,    0, "French",                        { 2, plural2_2 }  },    
// "nplurals=2; plural=(n > 1);"
-  { "fr", "CA", 0, "French (Canada)",               { 2, plural2_2 }  },    
// "nplurals=2; plural=(n > 1);"
-  { "fr", "CH", 0, "French (Switzerland)",          { 2, plural2_2 }  },    
// "nplurals=2; plural=(n > 1);"
-  { "fr", "FR", 0, "French (France)",               { 2, plural2_2 }  },    
// "nplurals=2; plural=(n > 1);"
-  { "fr", "LU", 0, "French (Luxembourg)",           { 2, plural2_2 }  },    
// "nplurals=2; plural=(n > 1);"
-  { "fy", 0,    0, "Frisian",                       { 2, plural2_1 }  },    
// unknown
-  { "ga", 0,    0, "Irish",                         { 3, plural3_ga } },    
// "nplurals=3; plural=n==1 ? 0 : n==2 ? 1 : 2;"
-  { "gd", 0,    0, "Gaelic Scots",                  { 2, plural2_1 }  },    
// unknown
-  { "gl", 0,    0, "Galician",                      { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "gl", "ES", 0, "Galician (Spain)",              { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "gn", 0,    0, "Guarani",                       { 2, plural2_1 }  },    
// unknown
-  { "gu", 0,    0, "Gujarati",                      { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "gv", 0,    0, "Manx",                          { 2, plural2_1 }  },    
// unknown
-  { "ha", 0,    0, "Hausa",                         { 2, plural2_1 }  },    
// unknown
-  { "he", 0,    0, "Hebrew",                        { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "he", "IL", 0, "Hebrew (Israel)",               { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "hi", 0,    0, "Hindi",                         { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "hr", 0,    0, "Croatian",                      { 3, plural3_1 }  },    
// "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 &&  
(n%100<10 || n%100>=20) ? 1 : 2);"
-  { "hr", "HR", 0, "Croatian (Croatia)",            { 3, plural3_1 }  },    
// "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 &&  
(n%100<10 || n%100>=20) ? 1 : 2);"
-  { "hu", 0,    0, "Hungarian",                     { 1, plural1 }    },    
// "nplurals=1; plural=0;"
-  { "hu", "HU", 0, "Hungarian (Hungary)",           { 1, plural1 }    },    
// "nplurals=1; plural=0;"
-  { "hy", 0,    0, "Armenian",                      { 2, plural2_2 }  },    
// "nplurals=2; plural=n > 1;"
-  { "ia", 0,    0, "Interlingua",                   { 2, plural2_1 }  },    
// unknown
-  { "id", 0,    0, "Indonesian",                    { 1, plural1 }    },    
// "nplurals=1; plural=0;"
-  { "id", "ID", 0, "Indonesian (Indonesia)",        { 1, plural1 }    },    
// "nplurals=1; plural=0;"
-  { "is", 0,    0, "Icelandic",                     { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "is", "IS", 0, "Icelandic (Iceland)",           { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "it", 0,    0, "Italian",                       { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "it", "CH", 0, "Italian (Switzerland)",         { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "it", "IT", 0, "Italian (Italy)",               { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "iu", 0,    0, "Inuktitut",                     { 2, plural2_1 }  },    
// unknown
-  { "ja", 0,    0, "Japanese",                      { 1, plural1 }    },    
// "nplurals=1; plural=0;"
-  { "ja", "JP", 0, "Japanese (Japan)",              { 1, plural1 }    },    
// "nplurals=1; plural=0;"
-  { "ka", 0,    0, "Georgian",                      { 1, plural1 }    },    
// "nplurals=1; plural=0;"
-  { "kk", 0,    0, "Kazakh",                        { 2, plural2_1 }  },    
// unknown
-  { "kl", 0,    0, "Kalaallisut",                   { 2, plural2_1 }  },    
// unknown
-  { "km", 0,    0, "Khmer",                         { 2, plural2_1 }  },    
// unknown
-  { "km", "KH", 0, "Khmer (Cambodia)",              { 2, plural2_1 }  },    
// unknown
-  { "kn", 0,    0, "Kannada",                       { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "ko", 0,    0, "Korean",                        { 1, plural1 }    },    
// "nplurals=1; plural=0;"
-  { "ko", "KR", 0, "Korean (Korea)",                { 1, plural1 }    },    
// "nplurals=1; plural=0;"
-  { "ku", 0,    0, "Kurdish",                       { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "kw", 0,    0, "Cornish",                       { 2, plural2_1 }  },    
// unknown
-  { "ky", 0,    0, "Kirghiz",                       { 1, plural1 }    },    
// "nplurals=1; plural=0;"
-  { "la", 0,    0, "Latin",                         { 2, plural2_1 }  },    
// unknown
-  { "lo", 0,    0, "Lao",                           { 2, plural2_1 }  },    
// unknown
-  { "lt", 0,    0, "Lithuanian",                    { 3, plural3_lt } },    
// "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 ||  
n%100>=20) ? 1 : 2);"
-  { "lt", "LT", 0, "Lithuanian (Lithuania)",        { 3, plural3_lt } },    
// "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 ||  
n%100>=20) ? 1 : 2);"
-  { "lv", 0,    0, "Latvian",                       { 3, plural3_lv } },    
// "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2);"
-  { "lv", "LV", 0, "Latvian (Latvia)",              { 3, plural3_lv } },    
// "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2);"
-  { "mg", 0,    0, "Malagasy",                      { 2, plural2_1 }  },    
// unknown
-  { "mi", 0,    0, "Maori",                         { 2, plural2_1 }  },    
// unknown
-  { "mk", 0,    0, "Macedonian",                    { 2, plural2_mk } },    
// plural= n==1 || n%10==1 ? 0 : 1
-  { "mk", "MK", 0, "Macedonian (Macedonia)",        { 2, plural2_mk } },    
// plural= n==1 || n%10==1 ? 0 : 1
-  { "ml", 0,    0, "Malayalam",                     { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "mn", 0,    0, "Mongolian",                     { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "mr", 0,    0, "Marathi",                       { 2, plural2_1 }  },    
// unknown
-  { "ms", 0,    0, "Malay",                         { 1, plural1 }    },    
// "nplurals=1; plural=0;"
-  { "ms", "MY", 0, "Malay (Malaysia)",              { 1, plural1 }    },    
// "nplurals=1; plural=0;"
-  { "mt", 0,    0, "Maltese",                       { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "my", 0,    0, "Burmese",                       { 2, plural2_1 }  },    
// unknown
-  { "my", "MM", 0, "Burmese (Myanmar)",             { 2, plural2_1 }  },    
// unknown
-  { "nb", 0,    0, "Norwegian Bokmal",              { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "nb", "NO", 0, "Norwegian Bokmål (Norway)",     { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "ne", 0,    0, "Nepali",                        { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "nl", 0,    0, "Dutch",                         { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "nl", "BE", 0, "Dutch (Belgium)",               { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "nl", "NL", 0, "Dutch (Netherlands)",           { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "nn", 0,    0, "Norwegian Nynorsk",             { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "nn", "NO", 0, "Norwegian Nynorsk (Norway)",    { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "no", 0,    0, "Norwegian",                     { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "no", "NO", 0, "Norwegian (Norway)",            { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "no", "NY", 0, "Norwegian (NY)",                { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "nr", 0,    0, "Ndebele, South",                { 2, plural2_1 }  },    
// unknown
-  { "oc", 0,    0, "Occitan post 1500",             { 2, plural2_1 }  },    
// unknown
-  { "om", 0,    0, "Oromo",                         { 2, plural2_1 }  },    
// unknown
-  { "or", 0,    0, "Oriya",                         { 2, plural2_1 }  },    
// unknown
-  { "pa", 0,    0, "Punjabi",                       { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "pl", 0,    0, "Polish",                        { 3, plural3_pl } },    
// "nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 ||  
n%100>=20) ? 1 : 2);
-  { "pl", "PL", 0, "Polish (Poland)",               { 3, plural3_pl } },    
// "nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 ||  
n%100>=20) ? 1 : 2);
-  { "ps", 0,    0, "Pashto",                        { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "pt", 0,    0, "Portuguese",                    { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "pt", "BR", 0, "Brazilian",                     { 2, plural2_2 }  },    
// "nplurals=2; plural=(n > 1);"
-  { "pt", "PT", 0, "Portuguese (Portugal)",         { 2, plural2_2 }  },    
// "nplurals=2; plural=(n > 1);"
-  { "qu", 0,    0, "Quechua",                       { 2, plural2_1 }  },    
// unknown
-  { "rm", 0,    0, "Rhaeto-Romance",                { 2, plural2_1 }  },    
// unknown
-  { "ro", 0,    0, "Romanian",                      { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "ro", "RO", 0, "Romanian (Romania)",            { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "ru", 0,    0, "Russian",                       { 3, plural3_1 }  },    
// "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 &&  
(n%100<10 || n%100>=20) ? 1 : 2);"
-  { "ru", "RU", 0, "Russian (Russia",               { 3, plural3_1 }  },    
// "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 &&  
(n%100<10 || n%100>=20) ? 1 : 2);"
-  { "rw", 0,    0, "Kinyarwanda",                   { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "sa", 0,    0, "Sanskrit",                      { 2, plural2_1 }  },    
// unknown
-  { "sd", 0,    0, "Sindhi",                        { 2, plural2_1 }  },    
// unknown
-  { "se", 0,    0, "Sami",                          { 2, plural2_1 }  },    
// unknown
-  { "se", "NO", 0, "Sami (Norway)",                 { 2, plural2_1 }  },    
// unknown
-  { "si", 0,    0, "Sinhalese",                     { 2, plural2_1 }  },    
// unknown
-  { "sk", 0,    0, "Slovak",                        { 3, plural3_sk } },    
// "nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;"
-  { "sk", "SK", 0, "Slovak (Slovakia)",             { 3, plural3_sk } },    
// "nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;"
-  { "sl", 0,    0, "Slovenian",                     { 3, plural3_sl } },    
// "nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 ||  
n%100==4 ? 2 : 3);"
-  { "sl", "SI", 0, "Slovenian (Slovenia)",          { 3, plural3_sl } },    
// "nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 ||  
n%100==4 ? 2 : 3);"
-  { "sl", "SL", 0, "Slovenian (Sierra Leone)",      { 3, plural3_sl } },    
// "nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 ||  
n%100==4 ? 2 : 3);"
-  { "sm", 0,    0, "Samoan",                        { 2, plural2_1 }  },    
// unknown
-  { "so", 0,    0, "Somali",                        { 2, plural2_1 }  },    
// unknown
-  { "sp", 0,    0, "Unknown language",              { 2, plural2_1 }  },    
// unknown
-  { "sq", 0,    0, "Albanian",                      { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "sq", "AL", 0, "Albanian (Albania)",            { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "sr", 0,    0, "Serbian",                       { 3, plural3_1 }  },    
// "nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 &&  
(n%100<10 || n%100>=20) ? 1 : 2;"
-  { "sr", "YU", 0, "Serbian (Yugoslavia)",          { 3, plural3_1 }  },    
// "nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 &&  
(n%100<10 || n%100>=20) ? 1 : 2;"
-  { "sr", 0,"ije", "Serbian",                       { 3, plural3_1 }  },    
// "nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 &&  
(n%100<10 || n%100>=20) ? 1 : 2;"
-  { "sr", 0, "latin", "Serbian",                    { 3, plural3_1 }  },    
// "nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 &&  
(n%100<10 || n%100>=20) ? 1 : 2;"
-  { "sr", 0, "Latn",  "Serbian",                    { 3, plural3_1 }  },    
// "nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 &&  
(n%100<10 || n%100>=20) ? 1 : 2;"
-  { "ss", 0,    0, "Swati",                         { 2, plural2_1 }  },    
// unknown
-  { "st", 0,    0, "Sotho",                         { 2, plural2_1 }  },    
// unknown
-  { "sv", 0,    0, "Swedish",                       { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "sv", "SE", 0, "Swedish (Sweden)",              { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "sv", "SV", 0, "Swedish (El Salvador)",         { 2, plural2_1 }  },    
// "nplurals=2; plural=(n != 1);"
-  { "sw", 0,    0, "Swahili",                       { 2, plural2_1 }  },    
// unknown
-  { "ta", 0,    0, "Tamil",                         { 2, plural2_1 }  },    
// unknown
-  { "te", 0,    0, "Telugu",                        { 2, plural2_1 }  },    
// unknown
-  { "tg", 0,    0, "Tajik",                         { 2, plural2_1 }  },    
// unknown
-  { "th", 0,    0, "Thai",                          { 1, plural1 }    },    
// "nplurals=1; plural=0;"
-  { "th", "TH", 0, "Thai (Thailand)",               { 1, plural1 }    },    
// "nplurals=1; plural=0;"
-  { "ti", 0,    0, "Tigrinya",                      { 2, plural2_1 }  },    
// unknown
-  { "tk", 0,    0, "Turkmen",                       { 2, plural2_1 }  },    
// unknown
-  { "tl", 0,    0, "Tagalog",                       { 2, plural2_1 }  },    
// unknown
-  { "to", 0,    0, "Tonga",                         { 2, plural2_1 }  },    
// unknown
-  { "tr", 0,    0, "Turkish",                       { 1, plural1 }    },    
// "nplurals=1; plural=0;"
-  { "tr", "TR", 0, "Turkish (Turkey)",              { 1, plural1 }    },    
// "nplurals=1; plural=0;"
-  { "ts", 0,    0, "Tsonga",                        { 2, plural2_1 }  },    
// unknown
-  { "tt", 0,    0, "Tatar",                         { 2, plural2_1 }  },    
// unknown
-  { "ug", 0,    0, "Uighur",                        { 2, plural2_1 }  },    
// unknown
-  { "uk", 0,    0, "Ukrainian",                     { 3, plural3_1 }  },    
// "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 &&  
(n%100<10 || n%100>=20) ? 1 : 2);"
-  { "uk", "UA", 0, "Ukrainian (Ukraine)",           { 3, plural3_1 }  },    
// "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 &&  
(n%100<10 || n%100>=20) ? 1 : 2);"
-  { "ur", 0,    0, "Urdu",                          { 2, plural2_1 }  },    
// unknown
-  { "ur", "PK", 0, "Urdu (Pakistan)",               { 2, plural2_1 }  },    
// unknown
-  { "uz", 0,    0, "Uzbek",                         { 2, plural2_1 }  },    
// unknown
-  { "uz", 0, "cyrillic", "Uzbek",                   { 2, plural2_1 }  },    
// unknown
-  { "vi", 0,    0, "Vietnamese",                    { 1, plural1 }    },    
// "nplurals=1; plural=0;"
-  { "vi", "VN", 0, "Vietnamese (Vietnam)",          { 1, plural1 }    },    
// "nplurals=1; plural=0;"
-  { "wa", 0,    0, "Walloon",                       { 2, plural2_2 }  },    
// "nplurals=2; plural=n > 1;"
-  { "wo", 0,    0, "Wolof",                         { 2, plural2_1 }  },    
// unknown
-  { "xh", 0,    0, "Xhosa",                         { 1, plural1 }    },    
// "nplurals=2; plural=(n != 1);"
-  { "yi", 0,    0, "Yiddish",                       { 2, plural2_1 }  },    
// unknown
-  { "yo", 0,    0, "Yoruba",                        { 2, plural2_1 }  },    
// unknown
-  { "zh", 0,    0, "Chinese",                       { 1, plural1 }    },    
// "nplurals=1; plural=0;"
-  { "zh", "CN", 0, "Chinese (simplified)",          { 1, plural1 }    },    
// "nplurals=1; plural=0;"
-  { "zh", "HK", 0, "Chinese (Hong Kong)",           { 1, plural1 }    },    
// "nplurals=1; plural=0;"
-  { "zh", "TW", 0, "Chinese (traditional)",         { 1, plural1 }    },    
// "nplurals=1; plural=0;"
-  { "zu", 0,    0, "Zulu",                          { 2, plural2_1 }  },    
// guessed
+  { "aa", 0,    0, "Afar"                        },
+  { "af", 0,    0, "Afrikaans"                   },
+  { "af", "ZA", 0, "Afrikaans (South Africa)"    },
+  { "am", 0,    0, "Amharic"                     },
+  { "ar", 0,    0, "Arabic"                      },
+  { "ar", "AR", 0, "Arabic (Argentina)"          },
+  { "ar", "OM", 0, "Arabic (Oman)"               },
+  { "ar", "SA", 0, "Arabic (Saudi Arabia)"       },
+  { "ar", "SY", 0, "Arabic (Syrian Arab Republic)" },
+  { "ar", "TN", 0, "Arabic (Tunisia)"            },
+  { "as", 0,    0, "Assamese"                    },
+  { "ast",0,    0, "Asturian"                    },
+  { "ay", 0,    0, "Aymara"                      },
+  { "az", 0,    0, "Azerbaijani"                 },
+  { "az", "IR", 0, "Azerbaijani (Iran)"          },
+  { "be", 0,    0, "Belarusian"                  },
+  { "be", 0, "latin", "Belarusian"               },
+  { "bg", 0,    0, "Bulgarian"                   },
+  { "bg", "BG", 0, "Bulgarian (Bulgaria)"        },
+  { "bn", 0,    0, "Bengali"                     },
+  { "bn", "BD", 0, "Bengali (Bangladesh)"        },
+  { "bn", "IN", 0, "Bengali (India)"             },
+  { "bo", 0,    0, "Tibetan"                     },
+  { "br", 0,    0, "Breton"                      },
+  { "bs", 0,    0, "Bosnian"                     },
+  { "bs", "BA", 0, "Bosnian (Bosnia/Herzegovina)"},
+  { "bs", "BS", 0, "Bosnian (Bahamas)"           },
+  { "ca", "ES", "valencia", "Catalan (valencia)" },
+  { "ca", "ES", 0, "Catalan (Spain)"             },
+  { "ca", 0,    "valencia", "Catalan (valencia)" },
+  { "ca", 0,    0, "Catalan"                     },
+  { "co", 0,    0, "Corsican"                    },
+  { "cs", 0,    0, "Czech"                       },
+  { "cs", "CZ", 0, "Czech (Czech Republic)"      },
+  { "cy", 0,    0, "Welsh"                       },
+  { "cy", "GB", 0, "Welsh (Great Britain)"       },
+  { "cz", 0,    0, "Unknown language"            },
+  { "da", 0,    0, "Danish"                      },
+  { "da", "DK", 0, "Danish (Denmark)"            },
+  { "de", 0,    0, "German"                      },
+  { "de", "AT", 0, "German (Austria)"            },
+  { "de", "CH", 0, "German (Switzerland)"        },
+  { "de", "DE", 0, "German (Germany)"            },
+  { "dk", 0,    0, "Unknown language"            },
+  { "dz", 0,    0, "Dzongkha"                    },
+  { "el", 0,    0, "Greek"                       },
+  { "el", "GR", "Greek (Greece)"                 },
+  { "en", 0,    0, "English"                     },
+  { "en", "AU", 0, "English (Australia)"         },
+  { "en", "CA", 0, "English (Canada)"            },
+  { "en", "GB", 0, "English (Great Britain)"     },
+  { "en", "US", 0, "English (United States)"     },
+  { "en", "ZA", 0, "English (South Africa)"      },
+  { "en", 0, "boldquot", "English"               },
+  { "en", 0, "quot", "English"                   },
+  { "en" "US" "piglatin", "English"              },
+  { "eo", 0,    0, "Esperanto"                   },
+  { "es", 0,    0, "Spanish"                     },
+  { "es", "AR", 0, "Spanish (Argentina)"         },
+  { "es", "CL", 0, "Spanish (Chile)"             },
+  { "es", "CO", 0, "Spanish (Colombia)"          },
+  { "es", "CR", 0, "Spanish (Costa Rica)"        },
+  { "es", "DO", 0, "Spanish (Dominican Republic)"},
+  { "es", "EC", 0, "Spanish (Ecuador)"           },
+  { "es", "ES", 0, "Spanish (Spain)"             },
+  { "es", "GT", 0, "Spanish (Guatemala)"         },
+  { "es", "HN", 0, "Spanish (Honduras)"          },
+  { "es", "LA", 0, "Spanish (Laos)"              },
+  { "es", "MX", 0, "Spanish (Mexico)"            },
+  { "es", "NI", 0, "Spanish (Nicaragua)"         },
+  { "es", "PA", 0, "Spanish (Panama)"            },
+  { "es", "PE", 0, "Spanish (Peru)"              },
+  { "es", "PR", 0, "Spanish (Puerto Rico)"       },
+  { "es", "SV", 0, "Spanish (El Salvador)"       },
+  { "es", "UY", 0, "Spanish (Uruguay)"           },
+  { "es", "VE", 0, "Spanish (Venezuela)"         },
+  { "et", 0,    0, "Estonian"                    },
+  { "et", "EE", 0, "Estonian (Estonia)"          },
+  { "et", "ET", 0, "Estonian (Ethiopia)"         },
+  { "eu", 0,    0, "Basque"                      },
+  { "eu", "ES", 0, "Basque (Spain)"              },
+  { "fa", 0,    0, "Persian"                     },
+  { "fa", "AF", 0, "Persian (Afghanistan)"       },
+  { "fa", "IR", 0, "Persian (Iran)"              },
+  { "fi", 0,    0, "Finnish"                     },
+  { "fi", "FI", 0, "Finnish (Finland)"           },
+  { "fo", 0,    0, "Faroese"                     },
+  { "fo", "FO", 0, "Faeroese (Faroe Islands)"    },
+  { "fr", 0,    0, "French"                      },
+  { "fr", "CA", 0, "French (Canada)"             },
+  { "fr", "CH", 0, "French (Switzerland)"        },
+  { "fr", "FR", 0, "French (France)"             },
+  { "fr", "LU", 0, "French (Luxembourg)"         },
+  { "fy", 0,    0, "Frisian"                     },
+  { "ga", 0,    0, "Irish"                       },
+  { "gd", 0,    0, "Gaelic Scots"                },
+  { "gl", 0,    0, "Galician"                    },
+  { "gl", "ES", 0, "Galician (Spain)"            },
+  { "gn", 0,    0, "Guarani"                     },
+  { "gu", 0,    0, "Gujarati"                    },
+  { "gv", 0,    0, "Manx"                        },
+  { "ha", 0,    0, "Hausa"                       },
+  { "he", 0,    0, "Hebrew"                      },
+  { "he", "IL", 0, "Hebrew (Israel)"             },
+  { "hi", 0,    0, "Hindi"                       },
+  { "hr", 0,    0, "Croatian"                    },
+  { "hr", "HR", 0, "Croatian (Croatia)"          },
+  { "hu", 0,    0, "Hungarian"                   },
+  { "hu", "HU", 0, "Hungarian (Hungary)"         },
+  { "hy", 0,    0, "Armenian"                    },
+  { "ia", 0,    0, "Interlingua"                 },
+  { "id", 0,    0, "Indonesian"                  },
+  { "id", "ID", 0, "Indonesian (Indonesia)"      },
+  { "is", 0,    0, "Icelandic"                   },
+  { "is", "IS", 0, "Icelandic (Iceland)"         },
+  { "it", 0,    0, "Italian"                     },
+  { "it", "CH", 0, "Italian (Switzerland)"       },
+  { "it", "IT", 0, "Italian (Italy)"             },
+  { "iu", 0,    0, "Inuktitut"                   },
+  { "ja", 0,    0, "Japanese"                    },
+  { "ja", "JP", 0, "Japanese (Japan)"            },
+  { "ka", 0,    0, "Georgian"                    },
+  { "kk", 0,    0, "Kazakh"                      },
+  { "kl", 0,    0, "Kalaallisut"                 },
+  { "km", 0,    0, "Khmer"                       },
+  { "km", "KH", 0, "Khmer (Cambodia)"            },
+  { "kn", 0,    0, "Kannada"                     },
+  { "ko", 0,    0, "Korean"                      },
+  { "ko", "KR", 0, "Korean (Korea)"              },
+  { "ku", 0,    0, "Kurdish"                     },
+  { "kw", 0,    0, "Cornish"                     },
+  { "ky", 0,    0, "Kirghiz"                     },
+  { "la", 0,    0, "Latin"                       },
+  { "lo", 0,    0, "Lao"                         },
+  { "lt", 0,    0, "Lithuanian"                  },
+  { "lt", "LT", 0, "Lithuanian (Lithuania)"      },
+  { "lv", 0,    0, "Latvian"                     },
+  { "lv", "LV", 0, "Latvian (Latvia)"            },
+  { "mg", 0,    0, "Malagasy"                    },
+  { "mi", 0,    0, "Maori"                       },
+  { "mk", 0,    0, "Macedonian"                  },
+  { "mk", "MK", 0, "Macedonian (Macedonia)"      },
+  { "ml", 0,    0, "Malayalam"                   },
+  { "mn", 0,    0, "Mongolian"                   },
+  { "mr", 0,    0, "Marathi"                     },
+  { "ms", 0,    0, "Malay"                       },
+  { "ms", "MY", 0, "Malay (Malaysia)"            },
+  { "mt", 0,    0, "Maltese"                     },
+  { "my", 0,    0, "Burmese"                     },
+  { "my", "MM", 0, "Burmese (Myanmar)"           },
+  { "nb", 0,    0, "Norwegian Bokmal"            },
+  { "nb", "NO", 0, "Norwegian Bokmål (Norway)"   },
+  { "ne", 0,    0, "Nepali"                      },
+  { "nl", 0,    0, "Dutch"                       },
+  { "nl", "BE", 0, "Dutch (Belgium)"             },
+  { "nl", "NL", 0, "Dutch (Netherlands)"         },
+  { "nn", 0,    0, "Norwegian Nynorsk"           },
+  { "nn", "NO", 0, "Norwegian Nynorsk (Norway)"  },
+  { "no", 0,    0, "Norwegian"                   },
+  { "no", "NO", 0, "Norwegian (Norway)"          },
+  { "no", "NY", 0, "Norwegian (NY)"              },
+  { "nr", 0,    0, "Ndebele, South"              },
+  { "oc", 0,    0, "Occitan post 1500"           },
+  { "om", 0,    0, "Oromo"                       },
+  { "or", 0,    0, "Oriya"                       },
+  { "pa", 0,    0, "Punjabi"                     },
+  { "pl", 0,    0, "Polish"                      },
+  { "pl", "PL", 0, "Polish (Poland)"             },
+  { "ps", 0,    0, "Pashto"                      },
+  { "pt", 0,    0, "Portuguese"                  },
+  { "pt", "BR", 0, "Brazilian"                   },
+  { "pt", "PT", 0, "Portuguese (Portugal)"       },
+  { "qu", 0,    0, "Quechua"                     },
+  { "rm", 0,    0, "Rhaeto-Romance"              },
+  { "ro", 0,    0, "Romanian"                    },
+  { "ro", "RO", 0, "Romanian (Romania)"          },
+  { "ru", 0,    0, "Russian"                     },
+  { "ru", "RU", 0, "Russian (Russia"             },
+  { "rw", 0,    0, "Kinyarwanda"                 },
+  { "sa", 0,    0, "Sanskrit"                    },
+  { "sd", 0,    0, "Sindhi"                      },
+  { "se", 0,    0, "Sami"                        },
+  { "se", "NO", 0, "Sami (Norway)"               },
+  { "si", 0,    0, "Sinhalese"                   },
+  { "sk", 0,    0, "Slovak"                      },
+  { "sk", "SK", 0, "Slovak (Slovakia)"           },
+  { "sl", 0,    0, "Slovenian"                   },
+  { "sl", "SI", 0, "Slovenian (Slovenia)"        },
+  { "sl", "SL", 0, "Slovenian (Sierra Leone)"    },
+  { "sm", 0,    0, "Samoan"                      },
+  { "so", 0,    0, "Somali"                      },
+  { "sp", 0,    0, "Unknown language"            },
+  { "sq", 0,    0, "Albanian"                    },
+  { "sq", "AL", 0, "Albanian (Albania)"          },
+  { "sr", 0,    0, "Serbian"                     },
+  { "sr", "YU", 0, "Serbian (Yugoslavia)"        },
+  { "sr", 0,"ije", "Serbian"                     },
+  { "sr", 0, "latin", "Serbian"                  },
+  { "sr", 0, "Latn""Serbian"                     },
+  { "ss", 0,    0, "Swati"                       },
+  { "st", 0,    0, "Sotho"                       },
+  { "sv", 0,    0, "Swedish"                     },
+  { "sv", "SE", 0, "Swedish (Sweden)"            },
+  { "sv", "SV", 0, "Swedish (El Salvador)"       },
+  { "sw", 0,    0, "Swahili"                     },
+  { "ta", 0,    0, "Tamil"                       },
+  { "te", 0,    0, "Telugu"                      },
+  { "tg", 0,    0, "Tajik"                       },
+  { "th", 0,    0, "Thai"                        },
+  { "th", "TH", 0, "Thai (Thailand)"             },
+  { "ti", 0,    0, "Tigrinya"                    },
+  { "tk", 0,    0, "Turkmen"                     },
+  { "tl", 0,    0, "Tagalog"                     },
+  { "to", 0,    0, "Tonga"                       },
+  { "tr", 0,    0, "Turkish"                     },
+  { "tr", "TR", 0, "Turkish (Turkey)"            },
+  { "ts", 0,    0, "Tsonga"                      },
+  { "tt", 0,    0, "Tatar"                       },
+  { "ug", 0,    0, "Uighur"                      },
+  { "uk", 0,    0, "Ukrainian"                   },
+  { "uk", "UA", 0, "Ukrainian (Ukraine)"         },
+  { "ur", 0,    0, "Urdu"                        },
+  { "ur", "PK", 0, "Urdu (Pakistan)"             },
+  { "uz", 0,    0, "Uzbek"                       },
+  { "uz", 0, "cyrillic", "Uzbek"                 },
+  { "vi", 0,    0, "Vietnamese"                  },
+  { "vi", "VN", 0, "Vietnamese (Vietnam)"        },
+  { "wa", 0,    0, "Walloon"                     },
+  { "wo", 0,    0, "Wolof"                       },
+  { "xh", 0,    0, "Xhosa"                       },
+  { "yi", 0,    0, "Yiddish"                     },
+  { "yo", 0,    0, "Yoruba"                      },
+  { "zh", 0,    0, "Chinese"                     },
+  { "zh", "CN", 0, "Chinese (simplified)"        },
+  { "zh", "HK", 0, "Chinese (Hong Kong)"         },
+  { "zh", "TW", 0, "Chinese (traditional)"       },
+  { "zu", 0,    0, "Zulu"                        },
    { NULL }
  };
  //*}
@@ -553,23 +493,6 @@
      return "";
  }

-unsigned int
-Language::plural(int n) const
-{
-  if (language_spec)
-    return language_spec->plural_form.plural(n);
-  else
-    return 0;
-}
-
-int
-Language::plural_count() const
-{
-  if (language_spec)
-    return language_spec->plural_form.nplural;
-  else
-    return 0;
-}
  
  } // namespace tinygettext


Modified: branches/tinygettext-portable/src/language.hpp
==============================================================================
--- branches/tinygettext-portable/src/language.hpp	(original)
+++ branches/tinygettext-portable/src/language.hpp	Mon Feb  2 01:03:45 2009
@@ -17,34 +17,15 @@
  //  along with this program; if not, write to the Free Software
  //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,  
USA.

-#ifndef HEADER_LANGUAGE_DEF_HPP
-#define HEADER_LANGUAGE_DEF_HPP
+#ifndef HEADER_TINYGETTEXT_LANGUAGE_HPP
+#define HEADER_TINYGETTEXT_LANGUAGE_HPP

  #include <string>

  namespace tinygettext {
-
+
  struct LanguageSpec;

-typedef unsigned int (*PluralFunc)(int n);
-
-struct PluralForms
-{
-  int         nplural;
-  PluralFunc  plural;
-
-  static PluralForms from_string(const std::string& str);
-
-  static PluralForms create(int         nplural,
-                            PluralFunc  plural)
-  {
-    PluralForms forms;
-    forms.nplural = nplural;
-    forms.plural  = plural;
-    return forms;
-  }
-};
-
  /** Lightweight wrapper around LanguageSpec */
  class Language
  {
@@ -75,10 +56,8 @@
    std::string get_country()  const;
    std::string get_modifier()  const;
    std::string get_name()     const;
-  unsigned int plural(int n) const;
-  int plural_count() const;
  };
-
+
  } // namespace tinygettext

  #endif

Added: branches/tinygettext-portable/src/plural_forms.cpp
==============================================================================
--- (empty file)
+++ branches/tinygettext-portable/src/plural_forms.cpp	Mon Feb  2 01:03:45  
2009
@@ -0,0 +1,84 @@
+//  $Id$
+//
+//  tinygettext - A gettext replacement that works directly on .po files
+//  Copyright (C) 2006 Ingo Ruhnke <grumbel at gmx.de>
+//
+//  This program is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU General Public License
+//  as published by the Free Software Foundation; either version 2
+//  of the License, or (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,  
USA.
+
+#include <map>
+#include "plural_forms.hpp"
+
+namespace tinygettext {
+
+/**
+ *  Plural functions are used to select a string that matches a given
+ *  count. \a n is the count and the return value is the string index
+ *  used in the .po file, for example:
+ *
+ *   msgstr[0] = "You got %d error";
+ *   msgstr[1] = "You got %d errors";
+ *          ^-- return value of plural function
+ */
+unsigned int plural1(int )     { return 0; }
+unsigned int plural2_1(int n)  { return (n != 1); }
+unsigned int plural2_2(int n)  { return (n > 1); }
+unsigned int plural2_mk(int n) { return n==1 || n%10==1 ? 0 : 1; }
+unsigned int plural3_lv(int n) { return (n%10==1 && n%100!=11 ? 0 : n !=  
0 ? 1 : 2); }
+unsigned int plural3_ga(int n) { return n==1 ? 0 : n==2 ? 1 : 2; }
+unsigned int plural3_lt(int n) { return (n%10==1 && n%100!=11 ? 0 :  
n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2); }
+unsigned int plural3_1(int n)  { return (n%10==1 && n%100!=11 ? 0 :  
n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2); }
+unsigned int plural3_sk(int n) { return (n==1) ? 0 : (n>=2 && n<=4) ? 1 :  
2; }
+unsigned int plural3_pl(int n) { return (n==1 ? 0 : n%10>=2 && n%10<=4 &&  
(n%100<10 || n%100>=20) ? 1 : 2); }
+unsigned int plural3_sl(int n) { return (n%100==1 ? 0 : n%100==2 ? 1 :  
n%100==3 || n%100==4 ? 2 : 3); }
+unsigned int plural4_ar(int n) { return n==1 ? 0 : n==2 ? 1 : n>=3 &&  
n<=10 ? 2 : 3; }
+
+PluralForms
+PluralForms::from_string(const std::string& str)
+{
+  static std::map<std::string, struct PluralForms> plural_forms;
+
+  if (plural_forms.empty())
+    {
+      // FIXME: Could match some more strings if we cut out all spaces  
before compare
+      plural_forms["Plural-Forms: nplurals=1; plural=0;"]        =  
PluralForms::create(1, plural1);
+      plural_forms["Plural-Forms: nplurals=2; plural=(n != 1);"] =  
PluralForms::create(2, plural2_1);
+      plural_forms["Plural-Forms: nplurals=2; plural=(n > 1);"]  =  
PluralForms::create(2, plural2_2);
+      plural_forms["Plural-Forms: nplurals=2; plural=n==1 || n%10==1 ? 0 :  
1;"] = PluralForms::create(2, plural2_mk);
+
+      plural_forms["Plural-Forms: nplurals=3; plural=n%10==1 &&  
n%100!=11 ? 0 : n != 0 ? 1 : 2);"] = PluralForms::create(2, plural3_lv);
+      plural_forms["Plural-Forms: nplurals=3; plural=n==1 ? 0 : n==2 ? 1 :  
2;"] = PluralForms::create(3, plural3_ga);
+      plural_forms["Plural-Forms: nplurals=3; plural=(n%10==1 &&  
n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2);"] =  
PluralForms::create(3, plural3_lt);
+      plural_forms["Plural-Forms: nplurals=3; plural=(n%10==1 &&  
n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);"] =  
PluralForms::create(3, plural3_1);
+      plural_forms["Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 &&  
n<=4) ? 1 : 2;"] = PluralForms::create(3, plural3_sk);
+      plural_forms["Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2  
&& n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);"] = PluralForms::create(3,  
plural3_pl);
+      plural_forms["Plural-Forms: nplurals=3; plural=(n%100==1 ? 0 :  
n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);"] = PluralForms::create(3,  
plural3_sl);
+
+      plural_forms["Plural-Forms: nplurals=4; plural=n==1 ? 0 : n==2 ? 1 :  
n>=3 && n<=10 ? 2 : 3;"] = PluralForms::create(4, plural4_ar);
+  }
+
+  std::map<std::string, struct PluralForms>::const_iterator i=  
plural_forms.find(str);
+  if (i != plural_forms.end())
+    {
+      return i->second;
+    }
+  else
+    {
+      return PluralForms::create(0, 0);
+    }
+}
+
+} // namespace tinygettext
+
+/* EOF */

Added: branches/tinygettext-portable/src/plural_forms.hpp
==============================================================================
--- (empty file)
+++ branches/tinygettext-portable/src/plural_forms.hpp	Mon Feb  2 01:03:45  
2009
@@ -0,0 +1,50 @@
+//  $Id$
+//
+//  tinygettext - A gettext replacement that works directly on .po files
+//  Copyright (C) 2006 Ingo Ruhnke <grumbel at gmx.de>
+//
+//  This program is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU General Public License
+//  as published by the Free Software Foundation; either version 2
+//  of the License, or (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,  
USA.
+
+#ifndef HEADER_TINYGETTEXT_PLURAL_FORMS_HPP
+#define HEADER_TINYGETTEXT_PLURAL_FORMS_HPP
+
+#include <string>
+
+namespace tinygettext {
+
+typedef unsigned int (*PluralFunc)(int n);
+
+struct PluralForms
+{
+  int         nplural;
+  PluralFunc  plural;
+
+  static PluralForms from_string(const std::string& str);
+
+  static PluralForms create(int         nplural,
+                            PluralFunc  plural)
+  {
+    PluralForms forms;
+    forms.nplural = nplural;
+    forms.plural  = plural;
+    return forms;
+  }
+};
+
+} // namespace tinygettext
+
+#endif
+
+/* EOF */

Modified: branches/tinygettext-portable/src/po_parser.cpp
==============================================================================
--- branches/tinygettext-portable/src/po_parser.cpp	(original)
+++ branches/tinygettext-portable/src/po_parser.cpp	Mon Feb  2 01:03:45 2009
@@ -30,6 +30,7 @@
  #include "iconv.hpp"
  #include "dictionary.hpp"
  #include "po_parser.hpp"
+#include "plural_forms.hpp"

  namespace tinygettext {



More information about the Supertux-Commit mailing list