Commit 5bc69b92 by Shujing Zhao Committed by Shujing Zhao

re PR translation/39521 (specs diagnostics translation problems)

po/
2010-01-14  Shujing Zhao  <pearly.zhao@oracle.com>

        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  <pearly.zhao@oracle.com>

        PR translation/39521
        * gcc.c (do_spec_1): Wrapped the error and notice messages of specs
        strings with _().

From-SVN: r155878
parent 40c32948
2010-01-14 Shujing Zhao <pearly.zhao@oracle.com>
PR translation/39521
* gcc.c (do_spec_1): Wrapped the error and notice messages of specs
strings with _().
2010-01-13 Richard Guenther <rguenther@suse.de> 2010-01-13 Richard Guenther <rguenther@suse.de>
PR tree-optimization/42730 PR tree-optimization/42730
......
...@@ -5248,7 +5248,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part) ...@@ -5248,7 +5248,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
buf = (char *) alloca (p - q + 1); buf = (char *) alloca (p - q + 1);
strncpy (buf, q, p - q); strncpy (buf, q, p - q);
buf[p - q] = 0; buf[p - q] = 0;
error ("%s", buf); error ("%s", _(buf));
return -1; return -1;
} }
break; break;
...@@ -5262,7 +5262,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part) ...@@ -5262,7 +5262,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
buf = (char *) alloca (p - q + 1); buf = (char *) alloca (p - q + 1);
strncpy (buf, q, p - q); strncpy (buf, q, p - q);
buf[p - q] = 0; buf[p - q] = 0;
notice ("%s\n", buf); notice ("%s\n", _(buf));
if (*p) if (*p)
p++; p++;
} }
......
2010-01-14 Shujing Zhao <pearly.zhao@oracle.com>
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 <joseph@codesourcery.com> 2010-01-11 Joseph Myers <joseph@codesourcery.com>
* fi.po: Update. * fi.po: Update.
......
...@@ -75,12 +75,12 @@ pottmp=$pwd/$T/tmp.pot ...@@ -75,12 +75,12 @@ pottmp=$pwd/$T/tmp.pot
# Then generate keyword options for xgettext, by scanning for declarations # Then generate keyword options for xgettext, by scanning for declarations
# of functions whose parameter names end in "msgid". # 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. # driver specs, so those can be translated too.
# #
# All in one huge awk script. # 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 ( cd $srcdir
lang_subdirs=`echo */config-lang.in */*/config-lang.in | sed -e 's|config-lang\.in||g'` lang_subdirs=`echo */config-lang.in */*/config-lang.in | sed -e 's|config-lang\.in||g'`
...@@ -132,24 +132,34 @@ function keyword_option(line) { ...@@ -132,24 +132,34 @@ function keyword_option(line) {
} }
function spec_error_string (line) { function spec_error_string (line) {
while ((percent_index = index(line, "%e")) != 0) { if (index(line, "%e") != 0 && index(line, "%n") != 0) return
escape = substr(line, percent_index - 1, 1) while ((percent_index = index(line, "%e")) != 0 ||
(percent_index = index(line, "%n")) != 0) {
line = substr(line, percent_index + 2) line = substr(line, percent_index + 2)
if (escape == "%") continue
bracket_index = index(line, "}") bracket_index = index(line, "}")
newline_index = index(line, "\\n")
quote_index = index(line, "\"") quote_index = index(line, "\"")
if (bracket_index == 0) return if (bracket_index == 0 && newline_index == 0) return
if (quote_index != 0 && bracket_index > quote_index) return
if (bracket_index != 0) {
if (quote_index != 0 && bracket_index > quote_index) return
msgid = substr(line, 1, bracket_index - 1) msgid = substr(line, 1, bracket_index - 1)
line = substr(line, 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 (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("#line %d \"%s\"\n", lineno, file) > emsg
printf("_(\"%s\")\n", msgid) > emsg printf("_(\"%s\")\n", msgid) > emsg
} }
} }
...@@ -174,7 +184,7 @@ END { ...@@ -174,7 +184,7 @@ END {
while (getline < file) { while (getline < file) {
if (/^(#[ ]*define[ ]*)?[A-Za-z_].*\(.*msgid[,\)]/) { if (/^(#[ ]*define[ ]*)?[A-Za-z_].*\(.*msgid[,\)]/) {
keyword_option($0) keyword_option($0)
} else if (/%e/) { } else if (/%e/ || /%n/) {
spec_error_string($0) spec_error_string($0)
} }
lineno++ lineno++
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment