From 5bc69b925dfb46c3cc511a4a03c1c70da48d08de Mon Sep 17 00:00:00 2001 From: Shujing Zhao Date: Thu, 14 Jan 2010 06:28:27 +0000 Subject: re PR translation/39521 (specs diagnostics translation problems) po/ 2010-01-14 Shujing Zhao PR translation/39521 * exgettext: Extracted all specs %n strings and the %e strings that %e is at the start of a line. 2010-01-14 Shujing Zhao PR translation/39521 * gcc.c (do_spec_1): Wrapped the error and notice messages of specs strings with _(). From-SVN: r155878 --- gcc/ChangeLog | 6 ++++++ gcc/gcc.c | 4 ++-- gcc/po/ChangeLog | 6 ++++++ gcc/po/exgettext | 32 +++++++++++++++++++++----------- 4 files changed, 35 insertions(+), 13 deletions(-) (limited to 'gcc') diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a73cb95..80ab5e6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2010-01-14 Shujing Zhao + + PR translation/39521 + * gcc.c (do_spec_1): Wrapped the error and notice messages of specs + strings with _(). + 2010-01-13 Richard Guenther PR tree-optimization/42730 diff --git a/gcc/gcc.c b/gcc/gcc.c index d7d2b3b..8efb570 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -5248,7 +5248,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part) buf = (char *) alloca (p - q + 1); strncpy (buf, q, p - q); buf[p - q] = 0; - error ("%s", buf); + error ("%s", _(buf)); return -1; } break; @@ -5262,7 +5262,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part) buf = (char *) alloca (p - q + 1); strncpy (buf, q, p - q); buf[p - q] = 0; - notice ("%s\n", buf); + notice ("%s\n", _(buf)); if (*p) p++; } diff --git a/gcc/po/ChangeLog b/gcc/po/ChangeLog index 82bd289..5b09d0d 100644 --- a/gcc/po/ChangeLog +++ b/gcc/po/ChangeLog @@ -1,3 +1,9 @@ +2010-01-14 Shujing Zhao + + PR translation/39521 + * exgettext: Extracted all specs %n strings and the %e strings that %e + is at the start of a line. + 2010-01-11 Joseph Myers * fi.po: Update. diff --git a/gcc/po/exgettext b/gcc/po/exgettext index 9c22482..7ff3799 100644 --- a/gcc/po/exgettext +++ b/gcc/po/exgettext @@ -75,12 +75,12 @@ pottmp=$pwd/$T/tmp.pot # Then generate keyword options for xgettext, by scanning for declarations # of functions whose parameter names end in "msgid". # -# Finally, generate a source file containing all %e strings from +# Finally, generate a source file containing all %e and %n strings from # driver specs, so those can be translated too. # # All in one huge awk script. -echo "scanning for keywords and %e strings..." >&2 +echo "scanning for keywords, %e and %n strings..." >&2 ( cd $srcdir lang_subdirs=`echo */config-lang.in */*/config-lang.in | sed -e 's|config-lang\.in||g'` @@ -132,24 +132,34 @@ function keyword_option(line) { } function spec_error_string (line) { - while ((percent_index = index(line, "%e")) != 0) { - escape = substr(line, percent_index - 1, 1) + if (index(line, "%e") != 0 && index(line, "%n") != 0) return + while ((percent_index = index(line, "%e")) != 0 || + (percent_index = index(line, "%n")) != 0) { line = substr(line, percent_index + 2) - if (escape == "%") continue bracket_index = index(line, "}") + newline_index = index(line, "\\n") + quote_index = index(line, "\"") - if (bracket_index == 0) return - if (quote_index != 0 && bracket_index > quote_index) return + if (bracket_index == 0 && newline_index == 0) return - msgid = substr(line, 1, bracket_index - 1) - line = substr(line, bracket_index + 1) + if (bracket_index != 0) { + if (quote_index != 0 && bracket_index > quote_index) return + msgid = substr(line, 1, bracket_index - 1) + line = substr(line, bracket_index + 1) + } + else if (newline_index != 0) { + if (quote_index != 0 && quote_index > newline_index) return + msgid = substr(line, 1, newline_index - 1) + line = substr(line, newline_index + 1) + } if (index(msgid, "%") != 0) continue + if ((newline_index = index(msgid, "\\n")) != 0) + msgid = substr(msgid, 1, newline_index - 1) printf("#line %d \"%s\"\n", lineno, file) > emsg printf("_(\"%s\")\n", msgid) > emsg - } } @@ -174,7 +184,7 @@ END { while (getline < file) { if (/^(#[ ]*define[ ]*)?[A-Za-z_].*\(.*msgid[,\)]/) { keyword_option($0) - } else if (/%e/) { + } else if (/%e/ || /%n/) { spec_error_string($0) } lineno++ -- cgit v1.1