Home | History | Annotate | Line # | Download | only in tests
xgettext-tcl-1 revision 1.1.1.1
      1  1.1  christos #!/bin/sh
      2  1.1  christos 
      3  1.1  christos # Test of Tcl support.
      4  1.1  christos 
      5  1.1  christos tmpfiles=""
      6  1.1  christos trap 'rm -fr $tmpfiles' 1 2 3 15
      7  1.1  christos 
      8  1.1  christos tmpfiles="$tmpfiles xg-t-1.tcl"
      9  1.1  christos cat <<\EOF > xg-t-1.tcl
     10  1.1  christos #!/usr/bin/tclsh
     11  1.1  christos 
     12  1.1  christos proc isValid {target} {
     13  1.1  christos 	global viScreenId
     14  1.1  christos 	set address [valid $target]
     15  1.1  christos 	# This comment is not extracted.
     16  1.1  christos 	if {$address != 0} {
     17  1.1  christos 		# First comment line.
     18  1.1  christos 
     19  1.1  christos 		# Second comment line.
     20  1.1  christos 		viMsg $viScreenId [format [_ "%s is %s"] $target [string trim $address]]
     21  1.1  christos 	} else {
     22  1.1  christos 		viMsg $viScreenId [format [_ "%s not found"] $target]
     23  1.1  christos 	}
     24  1.1  christos }
     25  1.1  christos EOF
     26  1.1  christos 
     27  1.1  christos tmpfiles="$tmpfiles xg-t-1.err xg-t-1.tmp xg-t-1.pot"
     28  1.1  christos : ${XGETTEXT=xgettext}
     29  1.1  christos ${XGETTEXT} --add-comments --no-location -k_ -o xg-t-1.tmp xg-t-1.tcl 2>xg-t-1.err
     30  1.1  christos test $? = 0 || { cat xg-t-1.err; rm -fr $tmpfiles; exit 1; }
     31  1.1  christos grep -v 'POT-Creation-Date' < xg-t-1.tmp > xg-t-1.pot
     32  1.1  christos 
     33  1.1  christos tmpfiles="$tmpfiles xg-t-1.ok"
     34  1.1  christos cat <<\EOF > xg-t-1.ok
     35  1.1  christos # SOME DESCRIPTIVE TITLE.
     36  1.1  christos # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
     37  1.1  christos # This file is distributed under the same license as the PACKAGE package.
     38  1.1  christos # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
     39  1.1  christos #
     40  1.1  christos #, fuzzy
     41  1.1  christos msgid ""
     42  1.1  christos msgstr ""
     43  1.1  christos "Project-Id-Version: PACKAGE VERSION\n"
     44  1.1  christos "Report-Msgid-Bugs-To: \n"
     45  1.1  christos "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
     46  1.1  christos "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     47  1.1  christos "Language-Team: LANGUAGE <LL (at] li.org>\n"
     48  1.1  christos "MIME-Version: 1.0\n"
     49  1.1  christos "Content-Type: text/plain; charset=CHARSET\n"
     50  1.1  christos "Content-Transfer-Encoding: 8bit\n"
     51  1.1  christos 
     52  1.1  christos #. First comment line.
     53  1.1  christos #. Second comment line.
     54  1.1  christos #, tcl-format
     55  1.1  christos msgid "%s is %s"
     56  1.1  christos msgstr ""
     57  1.1  christos 
     58  1.1  christos #, tcl-format
     59  1.1  christos msgid "%s not found"
     60  1.1  christos msgstr ""
     61  1.1  christos EOF
     62  1.1  christos 
     63  1.1  christos : ${DIFF=diff}
     64  1.1  christos ${DIFF} xg-t-1.ok xg-t-1.pot
     65  1.1  christos result=$?
     66  1.1  christos 
     67  1.1  christos rm -fr $tmpfiles
     68  1.1  christos 
     69  1.1  christos exit $result
     70