]> 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 10:12:12 +0000 (12:12 +0200)
gettext-tools/src/ChangeLog
gettext-tools/src/xgettext.c
gettext-tools/tests/ChangeLog
gettext-tools/tests/xgettext-glade-7

index 38dc37618fae3cff497f7e57c3308c29a882937a..538987491655a8d24b86aeb0c45283ba82feb9d5 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-08-09  Daiki Ueno  <ueno@gnu.org>
 
        * x-gsettings.c (extract_gsettings): Add guard when expat is not
index c6b8b0eadab452bcdeb2355c6d23535e4fa12256..8e89a330e711c7b1b873f979140e32cb5cd201a6 100644 (file)
@@ -2289,7 +2289,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 1a0a5e57a43f9d7a020ac94e06d2891201924183..ca1c0ccf84d54154629dd238f011e8b8064f7e1e 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-08-06  Daiki Ueno  <ueno@gnu.org>
 
        xgettext: add support for GSettings schema file
index 168c8f443e9e88bf5d6d1f138994ea4d00d43caf..c2d36253d60f5ed98cdc71428864352ea6c4721f 100755 (executable)
@@ -67,6 +67,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">
@@ -187,6 +192,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"
@@ -209,13 +215,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 ""
 
@@ -235,37 +243,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 ""