Imported Upstream version 0.19.7
[platform/upstream/gettext.git] / gettext-tools / tests / msgfmt-desktop-1
1 #! /bin/sh
2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4 # Test iterative mode of msgfmt --desktop.
5
6 cat <<\EOF > mf.desktop
7 [Desktop Entry]
8 Type=Application
9 Name =Foo
10 Comment[foo]=Already translated comment
11 Comment= \sThis is a \nmultiline comment; for testing
12 Keywords=Keyword1;Keyword2;Key\;word3;
13 EOF
14
15 cat <<\EOF > fr.po
16 # SOME DESCRIPTIVE TITLE.
17 # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
18 # This file is distributed under the same license as the PACKAGE package.
19 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
20 #
21 #, fuzzy
22 msgid ""
23 msgstr ""
24 "Project-Id-Version: PACKAGE VERSION\n"
25 "Report-Msgid-Bugs-To: \n"
26 "POT-Creation-Date: 2014-03-17 07:36+0900\n"
27 "PO-Revision-Date: 2014-03-17 08:40+0900\n"
28 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
29 "Language-Team: LANGUAGE <LL@li.org>\n"
30 "Language: \n"
31 "MIME-Version: 1.0\n"
32 "Content-Type: text/plain; charset=UTF-8\n"
33 "Content-Transfer-Encoding: 8bit\n"
34
35 #: xg.desktop:4
36 msgid "Foo"
37 msgstr ""
38 "French\n"
39 "foo"
40
41 #: xg.desktop:5
42 msgid ""
43 " This is a \n"
44 "multiline comment; for testing"
45 msgstr ""
46 "French \n"
47 "comment"
48
49 #: xg.desktop:7
50 msgid "Keyword1;Keyword2;Key\\;word3;"
51 msgstr "one;two;thr\\;ee;"
52 EOF
53
54 cat <<\EOF > mf.desktop.ok
55 [Desktop Entry]
56 Type=Application
57 Name[fr]=French\nfoo
58 Name=Foo
59 Comment[foo]=Already translated comment
60 Comment[fr]=French \ncomment
61 Comment=\sThis is a \nmultiline comment; for testing
62 Keywords[fr]=one;two;thr\;ee;
63 Keywords=Keyword1;Keyword2;Key\;word3;
64 EOF
65
66 # Sanity checks for contradicting options.
67
68 ${MSGFMT} --desktop --template=mf.desktop -l fr fr.po \
69           >/dev/null 2>/dev/null \
70   && exit 1
71
72 ${MSGFMG} --desktop --template=mf.desktop fr.po -o mf.desktop.out \
73           >/dev/null 2>/dev/null \
74   && exit 1
75
76 # Proceed to the .desktop file generation.
77
78 ${MSGFMT} --desktop --template=mf.desktop -l fr fr.po -o mf.desktop.out \
79   || exit 1
80
81 : ${DIFF=diff}
82 ${DIFF} mf.desktop.ok mf.desktop.out
83 result=$?
84
85 exit $result