diff options
author | Bruno Haible <bruno@clisp.org> | 2007-06-28 11:14:12 +0000 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2009-06-23 12:14:57 +0200 |
commit | 7386c9e3382b9d551374ee826fdd4b65341ea065 (patch) | |
tree | 5926f72da3ea7d1235ccd1913d9cbdd83e9b6134 | |
parent | 43c0ae48680467785895f4f5ee3ad74682a1a081 (diff) | |
download | gettext-7386c9e3382b9d551374ee826fdd4b65341ea065.tar.gz |
Make the language name conforming to what the TP robot accepts.
-rw-r--r-- | gettext-tools/src/ChangeLog | 10 | ||||
-rw-r--r-- | gettext-tools/src/lang-table.c | 19 | ||||
-rw-r--r-- | gettext-tools/src/lang-table.h | 5 | ||||
-rw-r--r-- | gettext-tools/src/msginit.c | 20 |
4 files changed, 50 insertions, 4 deletions
diff --git a/gettext-tools/src/ChangeLog b/gettext-tools/src/ChangeLog index 1db53f534..b673f7ab1 100644 --- a/gettext-tools/src/ChangeLog +++ b/gettext-tools/src/ChangeLog @@ -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. diff --git a/gettext-tools/src/lang-table.c b/gettext-tools/src/lang-table.c index 5c4be904e..3773523bd 100644 --- a/gettext-tools/src/lang-table.c +++ b/gettext-tools/src/lang-table.c @@ -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]); diff --git a/gettext-tools/src/lang-table.h b/gettext-tools/src/lang-table.h index 49a5dd632..22b5b701e 100644 --- a/gettext-tools/src/lang-table.h +++ b/gettext-tools/src/lang-table.h @@ -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 */ diff --git a/gettext-tools/src/msginit.c b/gettext-tools/src/msginit.c index ce61c7304..19bb1ec29 100644 --- a/gettext-tools/src/msginit.c +++ b/gettext-tools/src/msginit.c @@ -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') |