]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Make the language name conforming to what the TP robot accepts.
authorBruno Haible <bruno@clisp.org>
Thu, 28 Jun 2007 11:14:12 +0000 (11:14 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:14:57 +0000 (12:14 +0200)
gettext-tools/src/ChangeLog
gettext-tools/src/lang-table.c
gettext-tools/src/lang-table.h
gettext-tools/src/msginit.c

index 1db53f5343be75123bf5baf4b4c3b537c297b84b..b673f7ab1573662443205f7638e6838234df5829 100644 (file)
@@ -1,3 +1,13 @@
+2007-06-28  Bruno Haible  <bruno@clisp.org>
+
+       * lang-table.h (language_variant_table, language_variant_table_size):
+       New declarations.
+       * lang-table.c (language_variant_table, language_variant_table_size):
+       New variables.
+       * msginit.c (language_team_englishname): New function.
+       (language_team): Use it instead of englishname_of_language.
+       Reported by Li Daobing <lidaobing@gmail.com>.
+
 2007-06-25  Bruno Haible  <bruno@clisp.org>
 
        Change boundary of extracted comments.
index 5c4be904efb2c97c4dcdf9cde839d9677f4da231..3773523bdf5d8d64b395465ce7a3155da920660d 100644 (file)
@@ -1,5 +1,5 @@
 /* Table of languages.
-   Copyright (C) 2001-2006 Free Software Foundation, Inc.
+   Copyright (C) 2001-2007 Free Software Foundation, Inc.
    Written by Bruno Haible <haible@clisp.cons.org>, 2005.
 
    This program is free software; you can redistribute it and/or modify
@@ -286,3 +286,20 @@ struct language_table_entry language_table[] =
     { "zap", "Zapotec" }
   };
 const size_t language_table_size = sizeof (language_table) / sizeof (language_table[0]);
+
+/* The language names for variants of languages, according to the catalog name
+   (usually built from the language code and territory code).
+   Should be consistent with the list of languages found on the TP site, see
+   the URL contained in gettext-tools/projects/TP/teams.url.  */
+struct language_table_entry language_variant_table[] =
+  {
+    { "de_AT", "Austrian" },
+    { "en_GB", "English (British)" },
+    { "es_AR", "Argentinian" },
+    { "es_IC", "Spanish (Canary Islands)" },
+    { "pt_BR", "Brazilian Portuguese" },
+    { "zh_CN", "Chinese (simplified)" },
+    { "zh_HK", "Chinese (Hong Kong)" },
+    { "zh_TW", "Chinese (traditional)" }
+  };
+const size_t language_variant_table_size = sizeof (language_variant_table) / sizeof (language_variant_table[0]);
index 49a5dd6323cb7be1ba64b23230f9c1acdfbad8af..22b5b701e4b7bbbf421fe425300d5000ffcd00d7 100644 (file)
@@ -1,5 +1,5 @@
 /* Table of languages.
-   Copyright (C) 2001-2006 Free Software Foundation, Inc.
+   Copyright (C) 2001-2007 Free Software Foundation, Inc.
    Written by Bruno Haible <haible@clisp.cons.org>, 2005.
 
    This program is free software; you can redistribute it and/or modify
@@ -30,4 +30,7 @@ struct language_table_entry
 extern struct language_table_entry language_table[];
 extern const size_t language_table_size;
 
+extern struct language_table_entry language_variant_table[];
+extern const size_t language_variant_table_size;
+
 #endif /* _LANG_TABLE_H */
index ce61c730462bc6fffa13aa09ded1b960f867f791..19bb1ec299ed469aab31199813a6df27b6b32389 100644 (file)
@@ -795,7 +795,7 @@ englishname_of_language ()
 {
   size_t i;
 
-  for (i = 0; i < language_table_size; i ++)
+  for (i = 0; i < language_table_size; i++)
     if (strcmp (language_table[i].code, language) == 0)
       return language_table[i].english;
 
@@ -1117,6 +1117,22 @@ last_translator ()
 }
 
 
+/* Return the name of the language used by the language team, in English.  */
+static const char *
+language_team_englishname ()
+{
+  size_t i;
+
+  /* Search for a name depending on the catalogname.  */
+  for (i = 0; i < language_variant_table_size; i++)
+    if (strcmp (language_variant_table[i].code, catalogname) == 0)
+      return language_variant_table[i].english;
+
+  /* Search for a name depending on the language only.  */
+  return englishname_of_language ();
+}
+
+
 /* Return the language team's mailing list address or homepage URL.  */
 static const char *
 language_team_address ()
@@ -1185,7 +1201,7 @@ language_team ()
     return "none";
   else
     {
-      const char *englishname = englishname_of_language ();
+      const char *englishname = language_team_englishname ();
       const char *address = language_team_address ();
 
       if (address != NULL && address[0] != '\0')