Home | History | Annotate | Line # | Download | only in tests
xgettext-glade-2 revision 1.1
      1  1.1  christos #!/bin/sh
      2  1.1  christos 
      3  1.1  christos # Test of Glade support, in particular ISO-8859-1 to UTF-8 conversion
      4  1.1  christos # and ASCII entities (< > ").
      5  1.1  christos 
      6  1.1  christos tmpfiles=""
      7  1.1  christos trap 'rm -fr $tmpfiles' 1 2 3 15
      8  1.1  christos 
      9  1.1  christos tmpfiles="$tmpfiles empty.glade"
     10  1.1  christos cat <<EOF > empty.glade
     11  1.1  christos <?xml version="1.0"?>
     12  1.1  christos <GTK-Interface/>
     13  1.1  christos EOF
     14  1.1  christos 
     15  1.1  christos tmpfiles="$tmpfiles xg-gl-2.pot"
     16  1.1  christos : ${XGETTEXT=xgettext}
     17  1.1  christos ${XGETTEXT} -o xg-gl-2.pot empty.glade 2>/dev/null
     18  1.1  christos test $? = 0 || {
     19  1.1  christos   echo "Skipping test: xgettext was built without Glade support"
     20  1.1  christos   rm -fr $tmpfiles; exit 77
     21  1.1  christos }
     22  1.1  christos 
     23  1.1  christos tmpfiles="$tmpfiles simple.glade"
     24  1.1  christos cat <<\EOF > simple.glade
     25  1.1  christos <?xml version="1.0" encoding="ISO-8859-1"?>
     26  1.1  christos <GTK-Interface>
     27  1.1  christos 
     28  1.1  christos 
     29  1.1  christos <widget>
     30  1.1  christos   <class>GtkWindow</class>
     31  1.1  christos   <name>HelloWindow</name>
     32  1.1  christos   <border_width>5</border_width>
     33  1.1  christos   <Signal>
     34  1.1  christos     <name>destroy</name>
     35  1.1  christos     <handler>gtk_main_quit</handler>
     36  1.1  christos   </Signal>
     37  1.1  christos   <title>Hello</title>
     38  1.1  christos   <type>GTK_WINDOW_TOPLEVEL</type>
     39  1.1  christos   <position>GTK_WIN_POS_NONE</position>
     40  1.1  christos   <allow_shrink>True</allow_shrink>
     41  1.1  christos   <allow_grow>True</allow_grow>
     42  1.1  christos   <auto_shrink>False</auto_shrink>
     43  1.1  christos 
     44  1.1  christos   <widget>
     45  1.1  christos     <class>GtkButton</class>
     46  1.1  christos     <name>Hello World</name>
     47  1.1  christos     <can_focus>True</can_focus>
     48  1.1  christos     <Signal>
     49  1.1  christos       <name>clicked</name>
     50  1.1  christos       <handler>gtk_widget_destroy</handler>
     51  1.1  christos       <object>HelloWindow</object>
     52  1.1  christos     </Signal>
     53  1.1  christos     <!-- Der bliche Programm-Gru -->
     54  1.1  christos     <label>Hello World</label>
     55  1.1  christos     <comments>This &lt;button&gt; displays &quot;Hello World&quot;.</comments>
     56  1.1  christos   </widget>
     57  1.1  christos </widget>
     58  1.1  christos 
     59  1.1  christos </GTK-Interface>
     60  1.1  christos EOF
     61  1.1  christos 
     62  1.1  christos tmpfiles="$tmpfiles xg-gl-2.tmp xg-gl-2.pot"
     63  1.1  christos : ${XGETTEXT=xgettext}
     64  1.1  christos ${XGETTEXT} --add-comments -o xg-gl-2.tmp simple.glade 
     65  1.1  christos test $? = 0 || { rm -fr $tmpfiles; exit 1; }
     66  1.1  christos grep -v 'POT-Creation-Date' < xg-gl-2.tmp > xg-gl-2.pot
     67  1.1  christos 
     68  1.1  christos tmpfiles="$tmpfiles xg-gl-2.ok"
     69  1.1  christos cat <<\EOF > xg-gl-2.ok
     70  1.1  christos # SOME DESCRIPTIVE TITLE.
     71  1.1  christos # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
     72  1.1  christos # This file is distributed under the same license as the PACKAGE package.
     73  1.1  christos # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
     74  1.1  christos #
     75  1.1  christos #, fuzzy
     76  1.1  christos msgid ""
     77  1.1  christos msgstr ""
     78  1.1  christos "Project-Id-Version: PACKAGE VERSION\n"
     79  1.1  christos "Report-Msgid-Bugs-To: \n"
     80  1.1  christos "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
     81  1.1  christos "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     82  1.1  christos "Language-Team: LANGUAGE <LL (at] li.org>\n"
     83  1.1  christos "MIME-Version: 1.0\n"
     84  1.1  christos "Content-Type: text/plain; charset=UTF-8\n"
     85  1.1  christos "Content-Transfer-Encoding: 8bit\n"
     86  1.1  christos 
     87  1.1  christos #: simple.glade:13
     88  1.1  christos msgid "Hello"
     89  1.1  christos msgstr ""
     90  1.1  christos 
     91  1.1  christos #. Der bliche Programm-Gru
     92  1.1  christos #: simple.glade:30
     93  1.1  christos msgid "Hello World"
     94  1.1  christos msgstr ""
     95  1.1  christos 
     96  1.1  christos #: simple.glade:31
     97  1.1  christos msgid "This <button> displays \"Hello World\"."
     98  1.1  christos msgstr ""
     99  1.1  christos EOF
    100  1.1  christos 
    101  1.1  christos : ${DIFF=diff}
    102  1.1  christos ${DIFF} xg-gl-2.ok xg-gl-2.pot
    103  1.1  christos result=$?
    104  1.1  christos 
    105  1.1  christos rm -fr $tmpfiles
    106  1.1  christos 
    107  1.1  christos exit $result
    108