2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
4 # Test of JavaScript support.
6 cat <<\EOF > xg-js-1.js
7 var s1 = "Simple string, no gettext needed",
8 s2 = _("Extract this first string");
10 var s3 = "Prefix _(" + _("Extract this second string") + ") Postfix";
12 if (document.getElementsById("foo")[0].innerHTML == _("Extract this third string")) {
13 /* _("This is a comment and must not be extracted!") */
15 /* TRANSLATORS: This is a translator comment. */
16 gettext('Extract this fourth string');
17 // TRANSLATORS: This is another translator comment.
18 gettext('Extract this fifth string');
21 : ${XGETTEXT=xgettext}
22 ${XGETTEXT} --add-comments=TRANSLATORS: --no-location -o xg-js-1.tmp xg-js-1.js 2>xg-js-1.err
23 test $? = 0 || { cat xg-js-1.err; exit 1; }
24 # Don't simplify this to "grep ... < xg-js-1.tmp", otherwise OpenBSD 4.0 grep
25 # only outputs "Binary file (standard input) matches".
26 cat xg-js-1.tmp | grep -v 'POT-Creation-Date' | LC_ALL=C tr -d '\r' > xg-js-1.pot
28 cat <<\EOF > xg-js-1.ok
29 # SOME DESCRIPTIVE TITLE.
30 # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
31 # This file is distributed under the same license as the PACKAGE package.
32 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
37 "Project-Id-Version: PACKAGE VERSION\n"
38 "Report-Msgid-Bugs-To: \n"
39 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
40 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
41 "Language-Team: LANGUAGE <LL@li.org>\n"
44 "Content-Type: text/plain; charset=CHARSET\n"
45 "Content-Transfer-Encoding: 8bit\n"
47 msgid "Extract this first string"
50 msgid "Extract this second string"
53 msgid "Extract this third string"
56 #. TRANSLATORS: This is a translator comment.
57 msgid "Extract this fourth string"
60 #. TRANSLATORS: This is another translator comment.
61 msgid "Extract this fifth string"
66 ${DIFF} xg-js-1.ok xg-js-1.pot