1#! /bin/sh
2. "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4# Test 'bulk' mode of msgfmt --xml.
5
6cat <<\EOF > mf.appdata.xml
7<?xml version="1.0" encoding="UTF-8"?>
8<component type="desktop">
9  <id>org.gnome.Characters.desktop</id>
10  <name>GNOME Characters</name>
11  <summary>Character map application</summary>
12  <licence>CC0</licence>
13  <description>
14    <p>
15      Characters is a simple utility application to find and insert
16      unusual characters.  It allows you to quickly find the character
17      you are looking for by searching for keywords.
18    </p>
19    <p>
20      You can also browse characters by categories, such as
21      Punctuation, Pictures, etc.
22    </p>
23  </description>
24  <url type="homepage">https://wiki.gnome.org/Design/Apps/CharacterMap</url>
25  <updatecontact>dueno_at_src.gnome.org</updatecontact>
26</component>
27EOF
28
29test -d po || mkdir po
30
31cat <<\EOF > po/fr.po
32# SOME DESCRIPTIVE TITLE.
33# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
34# This file is distributed under the same license as the PACKAGE package.
35# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
36#
37#, fuzzy
38msgid ""
39msgstr ""
40"Project-Id-Version: PACKAGE VERSION\n"
41"Report-Msgid-Bugs-To: \n"
42"POT-Creation-Date: 2014-03-17 07:36+0900\n"
43"PO-Revision-Date: 2014-03-17 08:40+0900\n"
44"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
45"Language-Team: LANGUAGE <LL@li.org>\n"
46"Language: \n"
47"MIME-Version: 1.0\n"
48"Content-Type: text/plain; charset=UTF-8\n"
49"Content-Transfer-Encoding: 8bit\n"
50
51msgid ""
52"Characters is a simple utility application to find and insert unusual "
53"characters. It allows you to quickly find the character you are looking for "
54"by searching for keywords."
55msgstr ""
56"Caractères est un utilitaire pour chercher et insérer des caractères "
57"inhabituels. Il vous permet de trouver rapidement le caractère que vous "
58"cherchez par le biais de mots-clés."
59
60msgid ""
61"You can also browse characters by categories, such as Punctuation, Pictures, "
62"etc."
63msgstr ""
64"Vous pouvez aussi naviguer dans les caractères par catégories, comme par "
65"Ponctuation, Images, etc."
66EOF
67
68cat <<\EOF > po/de.po
69# SOME DESCRIPTIVE TITLE.
70# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
71# This file is distributed under the same license as the PACKAGE package.
72# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
73#
74#, fuzzy
75msgid ""
76msgstr ""
77"Project-Id-Version: PACKAGE VERSION\n"
78"Report-Msgid-Bugs-To: \n"
79"POT-Creation-Date: 2014-03-17 07:36+0900\n"
80"PO-Revision-Date: 2014-03-17 08:40+0900\n"
81"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
82"Language-Team: LANGUAGE <LL@li.org>\n"
83"Language: \n"
84"MIME-Version: 1.0\n"
85"Content-Type: text/plain; charset=UTF-8\n"
86"Content-Transfer-Encoding: 8bit\n"
87
88msgid ""
89"Characters is a simple utility application to find and insert unusual "
90"characters. It allows you to quickly find the character you are looking for by "
91"searching for keywords."
92msgstr ""
93"Zeichen ist ein einfaches Hilfsprogramm zum Auffinden und Einsetzen von selten "
94"verwendeten Zeichen. Sie können schnell das gesuchte Zeichen finden, indem Sie "
95"nach Schlüsselwörtern suchen."
96
97msgid ""
98"You can also browse characters by categories, such as Punctuation, Pictures, "
99"etc."
100msgstr ""
101"Sie können ebenfalls nach Kategorie suchen, wie z.B. nach Zeichensetzung oder "
102"Bildern."
103EOF
104
105cat <<\EOF > mf.appdata.xml.ok
106<?xml version="1.0" encoding="UTF-8"?>
107<component type="desktop">
108  <id>org.gnome.Characters.desktop</id>
109  <name>GNOME Characters</name>
110  <summary>Character map application</summary>
111  <licence>CC0</licence>
112  <description>
113    <p>
114      Characters is a simple utility application to find and insert
115      unusual characters.  It allows you to quickly find the character
116      you are looking for by searching for keywords.
117    </p>
118    <p xml:lang="fr">Caractères est un utilitaire pour chercher et insérer des caractères inhabituels. Il vous permet de trouver rapidement le caractère que vous cherchez par le biais de mots-clés.</p>
119    <p xml:lang="de">Zeichen ist ein einfaches Hilfsprogramm zum Auffinden und Einsetzen von selten verwendeten Zeichen. Sie können schnell das gesuchte Zeichen finden, indem Sie nach Schlüsselwörtern suchen.</p>
120    <p>
121      You can also browse characters by categories, such as
122      Punctuation, Pictures, etc.
123    </p>
124    <p xml:lang="fr">Vous pouvez aussi naviguer dans les caractères par catégories, comme par Ponctuation, Images, etc.</p>
125    <p xml:lang="de">Sie können ebenfalls nach Kategorie suchen, wie z.B. nach Zeichensetzung oder Bildern.</p>
126  </description>
127  <url type="homepage">https://wiki.gnome.org/Design/Apps/CharacterMap</url>
128  <updatecontact>dueno_at_src.gnome.org</updatecontact>
129</component>
130EOF
131
132cat <<\EOF > mf.appdata.xml.desired.ok
133<?xml version="1.0" encoding="UTF-8"?>
134<component type="desktop">
135  <id>org.gnome.Characters.desktop</id>
136  <name>GNOME Characters</name>
137  <summary>Character map application</summary>
138  <licence>CC0</licence>
139  <description>
140    <p>
141      Characters is a simple utility application to find and insert
142      unusual characters.  It allows you to quickly find the character
143      you are looking for by searching for keywords.
144    </p>
145    <p xml:lang="fr">Caractères est un utilitaire pour chercher et insérer des caractères inhabituels. Il vous permet de trouver rapidement le caractère que vous cherchez par le biais de mots-clés.</p>
146    <p>
147      You can also browse characters by categories, such as
148      Punctuation, Pictures, etc.
149    </p>
150    <p xml:lang="fr">Vous pouvez aussi naviguer dans les caractères par catégories, comme par Ponctuation, Images, etc.</p>
151  </description>
152  <url type="homepage">https://wiki.gnome.org/Design/Apps/CharacterMap</url>
153  <updatecontact>dueno_at_src.gnome.org</updatecontact>
154</component>
155EOF
156
157unset LINGUAS
158
159# Sanity checks for contradicting options.
160
161${MSGFMT} --xml --template=mf.appdata.xml -d po -o mf.appdata.xml.out \
162          >/dev/null 2>/dev/null \
163  Exit 1
164
165test -d po/LINGUAS || mkdir po/LINGUAS
166
167${MSGFMT} --xml --template=mf.appdata.xml -d po -o mf.appdata.xml.out \
168          >/dev/null 2>/dev/null \
169  Exit 1
170
171rm -fr po/LINGUAS
172
173cat <<\EOF > po/LINGUAS
174de
175fr
176EOF
177
178${MSGFMT} --xml --template=mf.appdata.xml -d po \
179          >/dev/null 2>/dev/null \
180  && Exit 1
181
182${MSGFMT} --xml --template=mf.appdata.xml -d po -o mf.appdata.xml.out -l fr \
183          >/dev/null 2>/dev/null \
184  && Exit 1
185
186${MSGFMT} --xml --template=mf.appdata.xml -d po -o mf.appdata.xml.out po/fr.po \
187          >/dev/null 2>/dev/null \
188  && Exit 1
189
190# Proceed to the .desktop file generation.
191
192${MSGFMT} --xml --template=mf.appdata.xml -d po -o mf.appdata.xml.out || Exit 1
193: ${DIFF=diff}
194${DIFF} mf.appdata.xml.ok mf.appdata.xml.out
195test $? = 0 || Exit 1
196
197# Restrict the desired languages with the LINGUAS envvar.
198
199LINGUAS="fr ja" ${MSGFMT} --xml --template=mf.appdata.xml -d po -o mf.appdata.xml.desired.out || Exit 1
200
201: ${DIFF=diff}
202${DIFF} mf.appdata.xml.desired.ok mf.appdata.xml.desired.out
203test $? = 0 || Exit 1
204