]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
javascript: fix translator comment extraction in C-style comments
authorDaiki Ueno <ueno@gnu.org>
Thu, 14 Nov 2013 02:12:52 +0000 (11:12 +0900)
committerDaiki Ueno <ueno@gnu.org>
Thu, 14 Nov 2013 02:12:52 +0000 (11:12 +0900)
* src/x-javascript.c (comment_line_end): Add missing chars_to_remove
argument; all callers changed.
Reported by Illimar Tambek at: <http://savannah.gnu.org/bugs/?40573>.

* tests/xgettext-javascript-1: Add a test to extract translator comments.

gettext-tools/src/ChangeLog
gettext-tools/src/x-javascript.c
gettext-tools/tests/ChangeLog
gettext-tools/tests/xgettext-javascript-1

index a7f54226f9eba4c871ce90216abe0ffe853d1d06..c15fd7dfad836e53680692a23e5967987eafda32 100644 (file)
@@ -1,3 +1,9 @@
+2013-11-14  Daiki Ueno  <ueno@gnu.org>
+
+       * x-javascript.c (comment_line_end): Add missing chars_to_remove
+       argument; all callers changed.
+       Reported by Illimar Tambek at: <http://savannah.gnu.org/bugs/?40573>.
+
 2013-11-11  Daiki Ueno  <ueno@gnu.org>
 
        * x-c.c (phase5_get): Fix misuse of a logical operator.
index 565d84ff064d3da01191b197cbbe3873671371cc..9d166714fb8c42cb7345cc0f0cc70b623aef1cac 100644 (file)
@@ -545,10 +545,10 @@ comment_add (int c)
 }
 
 static inline const char *
-comment_line_end ()
+comment_line_end (size_t chars_to_remove)
 {
   char *buffer = unicode_string_buffer_result (&comment_buffer);
-  size_t buflen = strlen (buffer);
+  size_t buflen = strlen (buffer) - chars_to_remove;
 
   while (buflen >= 1
          && (buffer[buflen - 1] == ' ' || buffer[buflen - 1] == '\t'))
index f9cb507eba33269a2ac6ccd2b3d0a1e2338087f8..33efe8da745fc386933ba4ef5ca6b50a4f13db59 100644 (file)
@@ -1,3 +1,7 @@
+2013-11-14  Daiki Ueno  <ueno@gnu.org>
+
+       * xgettext-javascript-1: Add a test to extract translator comments.
+
 2013-08-30  Daiki Ueno  <ueno@gnu.org>
 
        * Makefile.am (gettextpo_1_prg_CPPFLAGS): Don't add 'gnulib-lib'
index 57a832df7ee65c77d096020b18613e9d2a5e6dd9..2f8115f92a42257d310d283f138938c3c1f64caa 100755 (executable)
@@ -13,9 +13,11 @@ var s1 = "Simple string, no gettext needed",
 function foo(a) {
     var s3 = "Prefix _(" + _("Extract this second string") + ") Postfix";
 }
-if (document.getElementsById("foo")[0].innerHTML == _("Extract this thirth string")) {
+if (document.getElementsById("foo")[0].innerHTML == _("Extract this third string")) {
     /* _("This is a comment and must not be extracted!") */
 }
+/* TRANSLATORS: This is a translator comment.  */
+gettext('Extract this fourth string');
 EOF
 
 tmpfiles="$tmpfiles xg-js-1.err xg-js-1.tmp xg-js-1.pot"
@@ -52,7 +54,11 @@ msgstr ""
 msgid "Extract this second string"
 msgstr ""
 
-msgid "Extract this thirth string"
+msgid "Extract this third string"
+msgstr ""
+
+#. TRANSLATORS: This is a translator comment.
+msgid "Extract this fourth string"
 msgstr ""
 EOF