1#!/bin/sh
2. "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4# Test of GtkBuilder support.
5# Checks that the extracted pot contains the right translatable
6# content, comments and context.
7
8cat <<EOF > xg-gl-6-empty.glade
9<?xml version="1.0"?>
10<GTK-Interface/>
11EOF
12
13: ${XGETTEXT=xgettext}
14${XGETTEXT} -o xg-gl-6.pot xg-gl-6-empty.glade 2>/dev/null
15test $? = 0 || {
16  echo "Skipping test: xgettext was built without Glade support"
17  Exit 77
18}
19
20cat <<EOF > xg-gl-6.ui
21<?xml version="1.0" encoding="UTF-8"?>
22<interface>
23  <!-- interface-requires gtk+ 3.0 -->
24  <object class="GtkWindow" id="window">
25    <property name="can_focus">False</property>
26    <property name="title" translatable="yes" context="This is the context for this text" comments="This is a comment for empty window">This is an empty window</property>
27    <child>
28      <placeholder/>
29    </child>
30  </object>
31</interface>
32EOF
33
34: ${XGETTEXT=xgettext}
35${XGETTEXT} -o xg-gl-6.tmp xg-gl-6.ui || Exit 1
36func_filter_POT_Creation_Date xg-gl-6.tmp xg-gl-6.pot
37
38cat <<EOF > xg-gl-6.ok
39# SOME DESCRIPTIVE TITLE.
40# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
41# This file is distributed under the same license as the PACKAGE package.
42# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
43#
44#, fuzzy
45msgid ""
46msgstr ""
47"Project-Id-Version: PACKAGE VERSION\n"
48"Report-Msgid-Bugs-To: \n"
49"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
50"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
51"Language-Team: LANGUAGE <LL@li.org>\n"
52"Language: \n"
53"MIME-Version: 1.0\n"
54"Content-Type: text/plain; charset=CHARSET\n"
55"Content-Transfer-Encoding: 8bit\n"
56
57#. This is a comment for empty window
58#: xg-gl-6.ui:6
59msgctxt "This is the context for this text"
60msgid "This is an empty window"
61msgstr ""
62EOF
63
64: ${DIFF=diff}
65${DIFF} xg-gl-6.ok xg-gl-6.pot
66result=$?
67
68test $result = 0 || {
69  exit $result
70}
71
72# Check with --extract-all option.
73${XGETTEXT} -a -o xg-gl-6.tmp xg-gl-6.ui || Exit 1
74func_filter_POT_Creation_Date xg-gl-6.tmp xg-gl-6.pot
75
76# Must be ignored.
77${DIFF} xg-gl-6.ok xg-gl-6.pot
78result=$?
79
80exit $result
81