3 # Test of JavaScript support.
6 trap 'rm -fr $tmpfiles' 1 2 3 15
8 tmpfiles="$tmpfiles xg-js-1.js"
9 cat <<\EOF > xg-js-1.js
10 var s1 = "Simple string, no gettext needed",
11 s2 = _("Extract this first string");
13 var s3 = "Prefix _(" + _("Extract this second string") + ") Postfix";
15 if (document.getElementsById("foo")[0].innerHTML == _("Extract this thirth string")) {
16 /* _("This is a comment and must not be extracted!") */
20 tmpfiles="$tmpfiles xg-js-1.err xg-js-1.tmp xg-js-1.pot"
21 : ${XGETTEXT=xgettext}
22 ${XGETTEXT} --add-comments --no-location -o xg-js-1.tmp xg-js-1.js 2>xg-js-1.err
23 test $? = 0 || { cat xg-js-1.err; rm -fr $tmpfiles; 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 tmpfiles="$tmpfiles xg-js-1.ok"
29 cat <<\EOF > xg-js-1.ok
30 # SOME DESCRIPTIVE TITLE.
31 # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
32 # This file is distributed under the same license as the PACKAGE package.
33 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
38 "Project-Id-Version: PACKAGE VERSION\n"
39 "Report-Msgid-Bugs-To: \n"
40 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
41 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
42 "Language-Team: LANGUAGE <LL@li.org>\n"
45 "Content-Type: text/plain; charset=CHARSET\n"
46 "Content-Transfer-Encoding: 8bit\n"
48 msgid "Extract this first string"
51 msgid "Extract this second string"
54 msgid "Extract this thirth string"
59 ${DIFF} xg-js-1.ok xg-js-1.pot