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