]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
glade: handle multi-line extracted comments
authorDaiki Ueno <ueno@gnu.org>
Mon, 12 Aug 2013 10:12:12 +0000 (12:12 +0200)
committerDaiki Ueno <ueno@gnu.org>
Mon, 12 Aug 2013 11:37:00 +0000 (13:37 +0200)
gettext-tools/src/ChangeLog
gettext-tools/src/xgettext.c
gettext-tools/tests/ChangeLog
gettext-tools/tests/xgettext-glade-7

index 430e0faff239f98c6ccbd994254d11e08993d7a5..6cd501f405caa5157f275ca873ddcf70bcc729e8 100644 (file)
@@ -1,3 +1,10 @@
+2013-08-12  Daiki Ueno  <ueno@gnu.org>
+
+       * xgettext.c (remember_a_message): Handle multi-line extracted
+       comments.
+       Reported by Gabor Kelemen in
+       <http://lists.gnu.org/archive/html/bug-gettext/2013-08/msg00026.html>.
+
 2013-07-11  Daiki Ueno  <ueno@gnu.org>
 
        Fix crash when parsing '..' with non-string argument.
index 702ceb0726e6aff57813da0f038bc53ff0a75f0c..507008fe28482220e8e5bece95c9e324f23fd7b0 100644 (file)
@@ -2277,7 +2277,29 @@ meta information, not the empty string.\n")));
     nitems_before = (mp->comment_dot != NULL ? mp->comment_dot->nitems : 0);
 
     if (extracted_comment != NULL)
-      message_comment_dot_append (mp, extracted_comment);
+      {
+        char *copy = xstrdup (extracted_comment);
+        char *rest;
+
+        rest = copy;
+        while (*rest != '\0')
+          {
+            char *newline = strchr (rest, '\n');
+
+            if (newline != NULL)
+              {
+                *newline = '\0';
+                message_comment_dot_append (mp, rest);
+                rest = newline + 1;
+              }
+            else
+              {
+                message_comment_dot_append (mp, rest);
+                break;
+              }
+          }
+        free (copy);
+      }
 
     add_all_remaining_comments = add_all_comments;
     for (j = 0; ; ++j)
index e342d7fbdbb58300bf5e3eae60108bfb6c6d0639..8e8b4dce5858fcaca09fe2da5a6167058ac896a6 100644 (file)
@@ -1,3 +1,7 @@
+2013-08-12  Daiki Ueno  <ueno@gnu.org>
+
+       * xgettext-glade-7: Add a test for multi-line extracted comments.
+
 2013-07-11  Daiki Ueno  <ueno@gnu.org>
 
        * xgettext-lua-1: Add test case for string concatenation.
index 09624f85683df515a8f71c6aa2e88480fd9b6252..f17eb59c6842d89aee7d9a254187cdae56b79ef6 100755 (executable)
@@ -66,6 +66,11 @@ cat <<EOF > xg-gl-7.ui
         <col id="1" translatable="yes" context="This is not translatable">Please...</col>
         <col id="2">86855555</col>
       </row>
+      <row>
+        <col id="0" translatable="yes" context="First row">Hi</col>
+        <col id="1" translatable="yes" comments="A multiline&#10;comment.">Comment</col>
+        <col id="2">999</col>
+      </row>
     </data>
   </object>
   <object class="GtkWindow" id="window">
@@ -186,6 +191,7 @@ EOF
 tmpfiles="$tmpfiles xg-gl-7.pot"
 : ${XGETTEXT=xgettext}
 ${XGETTEXT} -o - xg-gl-7.ui | grep -v 'POT-Creation-Date' > xg-gl-7.pot
+cp xg-gl-7.pot ..
 test $? = 0 || { rm -fr $tmpfiles; exit 1; }
 
 tmpfiles="$tmpfiles xg-gl-7.ok"
@@ -208,13 +214,15 @@ msgstr ""
 "Content-Type: text/plain; charset=CHARSET\n"
 "Content-Transfer-Encoding: 8bit\n"
 
-#: xg-gl-7.ui:30
+#: xg-gl-7.ui:30 xg-gl-7.ui:45
 msgctxt "First row"
 msgid "Hi"
 msgstr ""
 
 #. A comment.
-#: xg-gl-7.ui:31
+#. A multiline
+#. comment.
+#: xg-gl-7.ui:31 xg-gl-7.ui:46
 msgid "Comment"
 msgstr ""
 
@@ -234,37 +242,37 @@ msgid "Please..."
 msgstr ""
 
 #. This thing is the menu label
-#: xg-gl-7.ui:62
+#: xg-gl-7.ui:67
 msgctxt "Menu"
 msgid "One thing"
 msgstr ""
 
 #. This thing is the label in the inner menu.
-#: xg-gl-7.ui:70
+#: xg-gl-7.ui:75
 msgctxt "One thing"
 msgid "One thing"
 msgstr ""
 
 #. This is easy.
-#: xg-gl-7.ui:87
+#: xg-gl-7.ui:92
 msgctxt "Menu"
 msgid "H_elp"
 msgstr ""
 
 #. This one thing is for the second menu.
-#: xg-gl-7.ui:95
+#: xg-gl-7.ui:100
 msgctxt "Second menu"
 msgid "One thing"
 msgstr ""
 
 #. To you too.
-#: xg-gl-7.ui:105
+#: xg-gl-7.ui:110
 msgctxt "Second menu"
 msgid "Greetings"
 msgstr ""
 
 #. This one thing is the button.
-#: xg-gl-7.ui:142
+#: xg-gl-7.ui:147
 msgctxt "Button"
 msgid "One thing"
 msgstr ""