• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2. "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4# Test of Glade 2 support for msgctxt.
5
6cat <<EOF > xg-gl-5-empty.glade
7<?xml version="1.0"?>
8<GTK-Interface/>
9EOF
10
11: ${XGETTEXT=xgettext}
12${XGETTEXT} -o xg-gl-5.pot xg-gl-5-empty.glade 2>/dev/null
13test $? = 0 || {
14  echo "Skipping test: xgettext was built without Glade support"
15  Exit 77
16}
17
18cat <<EOF > xg-gl-5.glade
19<?xml version="1.0"?>
20<glade-interface>
21  <!-- interface-requires gtk+ 2.8 -->
22  <!-- interface-naming-policy project-wide -->
23  <widget class="GtkWindow" id="window1">
24    <child>
25      <widget class="GtkVBox" id="vbox">
26        <property name="visible">True</property>
27        <property name="orientation">vertical</property>
28        <child>
29          <widget class="GtkButton" id="with_context">
30            <property name="label" translatable="yes" context="yes">Shape|Form</property>
31            <property name="visible">True</property>
32            <property name="can_focus">True</property>
33            <property name="receives_default">True</property>
34          </widget>
35          <packing>
36            <property name="position">0</property>
37          </packing>
38        </child>
39        <child>
40          <widget class="GtkButton" id="without_context">
41            <property name="label" translatable="yes">Shape|Form</property>
42            <property name="visible">True</property>
43            <property name="can_focus">True</property>
44            <property name="receives_default">True</property>
45          </widget>
46          <packing>
47            <property name="position">1</property>
48          </packing>
49        </child>
50      </widget>
51    </child>
52  </widget>
53</glade-interface>
54EOF
55
56: ${XGETTEXT=xgettext}
57${XGETTEXT} -o xg-gl-5.tmp xg-gl-5.glade || Exit 1
58func_filter_POT_Creation_Date xg-gl-5.tmp xg-gl-5.pot
59
60cat <<\EOF > xg-gl-5.ok
61# SOME DESCRIPTIVE TITLE.
62# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
63# This file is distributed under the same license as the PACKAGE package.
64# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
65#
66#, fuzzy
67msgid ""
68msgstr ""
69"Project-Id-Version: PACKAGE VERSION\n"
70"Report-Msgid-Bugs-To: \n"
71"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
72"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
73"Language-Team: LANGUAGE <LL@li.org>\n"
74"Language: \n"
75"MIME-Version: 1.0\n"
76"Content-Type: text/plain; charset=CHARSET\n"
77"Content-Transfer-Encoding: 8bit\n"
78
79#: xg-gl-5.glade:12
80msgctxt "Shape"
81msgid "Form"
82msgstr ""
83
84#: xg-gl-5.glade:23
85msgid "Shape|Form"
86msgstr ""
87EOF
88
89: ${DIFF=diff}
90${DIFF} xg-gl-5.ok xg-gl-5.pot
91result=$?
92
93test $result = 0 || {
94  exit $result
95}
96
97# Check with --extract-all option
98rm xg-gl-5.tmp
99${XGETTEXT} -a -o xg-gl-5.tmp xg-gl-5.glade || Exit 1
100func_filter_POT_Creation_Date xg-gl-5.tmp xg-gl-5.pot
101
102${DIFF} xg-gl-5.ok xg-gl-5.pot
103result=$?
104
105test $result = 0 || {
106  exit $result
107}
108
109cat <<EOF > xg-gl-5b.glade
110<?xml version="1.0"?>
111<glade-interface>
112  <!-- interface-requires gtk+ 2.8 -->
113  <!-- interface-naming-policy project-wide -->
114  <widget class="GtkWindow" id="window1">
115    <child>
116      <widget class="GtkVBox" id="vbox">
117        <property name="visible">True</property>
118        <property name="orientation">vertical</property>
119        <child>
120          <widget class="GtkButton" id="with_context">
121            <property name="label" translatable="yes" context="yes">ShapeForm</property>
122            <property name="visible">True</property>
123            <property name="can_focus">True</property>
124            <property name="receives_default">True</property>
125          </widget>
126          <packing>
127            <property name="position">0</property>
128          </packing>
129        </child>
130        <child>
131          <widget class="GtkButton" id="without_context">
132            <property name="label" translatable="yes">Shape|Form</property>
133            <property name="visible">True</property>
134            <property name="can_focus">True</property>
135            <property name="receives_default">True</property>
136          </widget>
137          <packing>
138            <property name="position">1</property>
139          </packing>
140        </child>
141      </widget>
142    </child>
143  </widget>
144</glade-interface>
145EOF
146
147: ${XGETTEXT=xgettext}
148${XGETTEXT} -o xg-gl-5b.tmp xg-gl-5b.glade 2>/dev/null || Exit 1
149func_filter_POT_Creation_Date xg-gl-5b.tmp xg-gl-5b.pot
150
151cat <<\EOF > xg-gl-5b.ok
152# SOME DESCRIPTIVE TITLE.
153# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
154# This file is distributed under the same license as the PACKAGE package.
155# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
156#
157#, fuzzy
158msgid ""
159msgstr ""
160"Project-Id-Version: PACKAGE VERSION\n"
161"Report-Msgid-Bugs-To: \n"
162"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
163"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
164"Language-Team: LANGUAGE <LL@li.org>\n"
165"Language: \n"
166"MIME-Version: 1.0\n"
167"Content-Type: text/plain; charset=CHARSET\n"
168"Content-Transfer-Encoding: 8bit\n"
169
170#: xg-gl-5b.glade:23
171msgid "Shape|Form"
172msgstr ""
173EOF
174
175: ${DIFF=diff}
176${DIFF} xg-gl-5b.ok xg-gl-5b.pot
177result=$?
178
179exit $result
180