1#!/bin/sh 2. "${srcdir=.}/init.sh"; path_prepend_ . ../src 3 4# Test of JavaScript support. 5 6cat <<\EOF > xg-js-1.js 7var s1 = "Simple string, no gettext needed", 8 s2 = _("Extract this first string"); 9function foo(a) { 10 var s3 = "Prefix _(" + _("Extract this second string") + ") Postfix"; 11} 12if (document.getElementsById("foo")[0].innerHTML == _("Extract this third string")) { 13 /* _("This is a comment and must not be extracted!") */ 14} 15/* TRANSLATORS: This is a translator comment. */ 16gettext('Extract this fourth string'); 17// TRANSLATORS: This is another translator comment. 18gettext('Extract this fifth string'); 19EOF 20 21: ${XGETTEXT=xgettext} 22${XGETTEXT} --add-comments=TRANSLATORS: --no-location -o xg-js-1.tmp xg-js-1.js 2>xg-js-1.err 23test $? = 0 || { cat xg-js-1.err; Exit 1; } 24func_filter_POT_Creation_Date xg-js-1.tmp xg-js-1.pot 25 26cat <<\EOF > xg-js-1.ok 27# SOME DESCRIPTIVE TITLE. 28# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 29# This file is distributed under the same license as the PACKAGE package. 30# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. 31# 32#, fuzzy 33msgid "" 34msgstr "" 35"Project-Id-Version: PACKAGE VERSION\n" 36"Report-Msgid-Bugs-To: \n" 37"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 38"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" 39"Language-Team: LANGUAGE <LL@li.org>\n" 40"Language: \n" 41"MIME-Version: 1.0\n" 42"Content-Type: text/plain; charset=CHARSET\n" 43"Content-Transfer-Encoding: 8bit\n" 44 45msgid "Extract this first string" 46msgstr "" 47 48msgid "Extract this second string" 49msgstr "" 50 51msgid "Extract this third string" 52msgstr "" 53 54#. TRANSLATORS: This is a translator comment. 55msgid "Extract this fourth string" 56msgstr "" 57 58#. TRANSLATORS: This is another translator comment. 59msgid "Extract this fifth string" 60msgstr "" 61EOF 62 63: ${DIFF=diff} 64${DIFF} xg-js-1.ok xg-js-1.pot 65result=$? 66 67exit $result 68