Imported Upstream version 0.19.7
[platform/upstream/gettext.git] / gettext-tools / tests / xgettext-gsettings-1
1 #!/bin/sh
2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4 # Test of GSettings support.
5
6 cat <<EOF > xg-gs-1-empty.gschema.xml
7 <?xml version="1.0"?>
8 <schemalist/>
9 EOF
10
11 : ${XGETTEXT=xgettext}
12 ${XGETTEXT} -o xg-gs-1.pot xg-gs-1-empty.gschema.xml 2>/dev/null
13 test $? = 0 || {
14   echo "Skipping test: xgettext was built without GSettings support"
15   exit 77
16 }
17
18 cat <<EOF > xg-gs-1.gschema.xml
19 <?xml version="1.0"?>
20 <schemalist>
21   <schema id="org.gnome.example" path="/org/gnome/example/">
22     <key name="foo" type="i">
23       <default>0</default>
24       <!-- This is the first line.
25            This is the second line. -->
26       <summary>Example Integer Key</summary>
27       <description>
28         The example integer key to test that the default value is not
29         translated.
30       </description>
31     </key>
32     <key name="bar" type="s">
33       <default l10n="messages" context="Foo">
34         ' foo   bar   baz'
35       </default>
36     </key>
37     <key name="baz" type="s">
38       <default l10n="messages" context="Baz"></default>
39       <summary context="Baz"></summary>
40     </key>
41   </schema>
42 </schemalist>
43 EOF
44
45 : ${XGETTEXT=xgettext}
46 ${XGETTEXT} --add-comments -o - xg-gs-1.gschema.xml | grep -v 'POT-Creation-Date' > xg-gs-1.pot || exit 1
47
48 cat <<EOF > xg-gs-1.ok
49 # SOME DESCRIPTIVE TITLE.
50 # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
51 # This file is distributed under the same license as the PACKAGE package.
52 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
53 #
54 #, fuzzy
55 msgid ""
56 msgstr ""
57 "Project-Id-Version: PACKAGE VERSION\n"
58 "Report-Msgid-Bugs-To: \n"
59 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
60 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
61 "Language-Team: LANGUAGE <LL@li.org>\n"
62 "Language: \n"
63 "MIME-Version: 1.0\n"
64 "Content-Type: text/plain; charset=CHARSET\n"
65 "Content-Transfer-Encoding: 8bit\n"
66
67 #. This is the first line.
68 #. This is the second line.
69 #: xg-gs-1.gschema.xml:8
70 msgid "Example Integer Key"
71 msgstr ""
72
73 #: xg-gs-1.gschema.xml:9
74 msgid ""
75 "The example integer key to test that the default value is not translated."
76 msgstr ""
77
78 #: xg-gs-1.gschema.xml:15
79 msgctxt "Foo"
80 msgid "' foo   bar   baz'"
81 msgstr ""
82 EOF
83
84 : ${DIFF=diff}
85 ${DIFF} xg-gs-1.ok xg-gs-1.pot
86 result=$?
87
88 exit $result