Imported Upstream version 0.19.7
[platform/upstream/gettext.git] / gettext-tools / tests / msgfmt-xml-1
1 #! /bin/sh
2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4 # Test iterative mode of msgfmt --xml.
5
6 cat <<\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>
27 EOF
28
29 cat <<\EOF > fr.po
30 # SOME DESCRIPTIVE TITLE.
31 # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
32 # This file is distributed under the same license as the PACKAGE package.
33 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
34 #
35 #, fuzzy
36 msgid ""
37 msgstr ""
38 "Project-Id-Version: PACKAGE VERSION\n"
39 "Report-Msgid-Bugs-To: \n"
40 "POT-Creation-Date: 2014-03-17 07:36+0900\n"
41 "PO-Revision-Date: 2014-03-17 08:40+0900\n"
42 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
43 "Language-Team: LANGUAGE <LL@li.org>\n"
44 "Language: \n"
45 "MIME-Version: 1.0\n"
46 "Content-Type: text/plain; charset=UTF-8\n"
47 "Content-Transfer-Encoding: 8bit\n"
48
49 msgid ""
50 "Characters is a simple utility application to find and insert unusual "
51 "characters. It allows you to quickly find the character you are looking for "
52 "by searching for keywords."
53 msgstr ""
54 "Caractères est un utilitaire pour chercher et insérer des caractères "
55 "inhabituels. Il vous permet de trouver rapidement le caractère que vous "
56 "cherchez par le biais de mots-clés."
57
58 msgid ""
59 "You can also browse characters by categories, such as Punctuation, Pictures, "
60 "etc."
61 msgstr ""
62 "Vous pouvez aussi naviguer dans les caractères par catégories, comme par "
63 "Ponctuation, Images, etc."
64 EOF
65
66 cat <<\EOF > mf.appdata.xml.ok
67 <?xml version="1.0" encoding="UTF-8"?>
68 <component type="desktop">
69   <id>org.gnome.Characters.desktop</id>
70   <name>GNOME Characters</name>
71   <summary>Character map application</summary>
72   <licence>CC0</licence>
73   <description>
74     <p>
75       Characters is a simple utility application to find and insert
76       unusual characters.  It allows you to quickly find the character
77       you are looking for by searching for keywords.
78     </p>
79     <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>
80     <p>
81       You can also browse characters by categories, such as
82       Punctuation, Pictures, etc.
83     </p>
84     <p xml:lang="fr">Vous pouvez aussi naviguer dans les caractères par catégories, comme par Ponctuation, Images, etc.</p>
85   </description>
86   <url type="homepage">https://wiki.gnome.org/Design/Apps/CharacterMap</url>
87   <updatecontact>dueno_at_src.gnome.org</updatecontact>
88 </component>
89 EOF
90
91 # Sanity checks for contradicting options.
92
93 ${MSGFMT} --xml --template=mf.appdata.xml -l fr fr.po \
94           >/dev/null 2>/dev/null \
95   && exit 1
96
97 ${MSGFMG} --xml --template=mf.appdata.xml fr.po -o mf.appdata.xml.out \
98           >/dev/null 2>/dev/null \
99   && exit 1
100
101 # Proceed to the XML file generation.
102
103 ${MSGFMT} --xml --template=mf.appdata.xml -l fr fr.po -o mf.appdata.xml.out \
104   || exit 1
105
106 : ${DIFF=diff}
107 ${DIFF} mf.appdata.xml.ok mf.appdata.xml.out
108 result=$?
109 test $result = 0 || exit $result
110
111 # Test -L option.
112 cp mf.appdata.xml mf.xml
113 ${MSGFMT} --xml --template=mf.xml -L AppData -l fr fr.po -o mf.appdata.xml.out \
114   || exit 1
115 ${DIFF} mf.appdata.xml.ok mf.appdata.xml.out
116 result=$?
117 test $result = 0 || exit $result
118
119 exit $result