#!/bin/sh . "${srcdir=.}/init.sh"; path_prepend_ . ../src # Test of JavaScript template literal support. cat <<\EOF > xg-js-7.js var s0 = _(`A template literal without substitutions`); var s1 = _(`A template literal with embedded newlines`); var s2 = _(`A template literal with ${n} substitutions`); var s3 = _(`A template literal with several substitutions: ${a} and ${b} and ${c} and so on`); var s4 = `/${looks_like_regex}`; var s5 = _('not part of a regex'); var s6 = `that's a valid string. ` + _('This too'); var s7 = _(tag`A template literal with a tag`); var s8 = `a${`b${`c`+d}`}e`; var s9 = _("a normal string"); var s10 = `abc${foo({},_('should be extracted'))}xyz`; EOF : ${XGETTEXT=xgettext} ${XGETTEXT} --add-comments --no-location -o xg-js-7.tmp xg-js-7.js 2>xg-js-7.err test $? = 0 || { cat xg-js-7.err; Exit 1; } # Don't simplify this to "grep ... < xg-js-7.tmp", otherwise OpenBSD 4.0 grep # only outputs "Binary file (standard input) matches". cat xg-js-7.tmp | grep -v 'POT-Creation-Date' | LC_ALL=C tr -d '\r' > xg-js-7.pot cat <<\EOF > xg-js-7.ok # SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" msgid "A template literal without substitutions" msgstr "" msgid "" "A template literal with\n" "embedded\n" "newlines" msgstr "" msgid "not part of a regex" msgstr "" msgid "This too" msgstr "" msgid "a normal string" msgstr "" msgid "should be extracted" msgstr "" EOF : ${DIFF=diff} ${DIFF} xg-js-7.ok xg-js-7.pot result=$? exit $result