OSDN Git Service

po/
authorpzhao <pzhao@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 14 Jan 2010 06:28:27 +0000 (06:28 +0000)
committerpzhao <pzhao@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 14 Jan 2010 06:28:27 +0000 (06:28 +0000)
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 _().

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@155878 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/gcc.c
gcc/po/ChangeLog
gcc/po/exgettext

index a73cb95..80ab5e6 100644 (file)
@@ -1,3 +1,9 @@
+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>
 
        PR tree-optimization/42730
index d7d2b3b..8efb570 100644 (file)
--- 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++;
            }
index 82bd289..5b09d0d 100644 (file)
@@ -1,3 +1,9 @@
+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>
 
        * fi.po: Update.
index 9c22482..7ff3799 100644 (file)
@@ -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++