Imported Upstream version 0.19.7
[platform/upstream/gettext.git] / gettext-tools / tests / lang-ycp
1 #! /bin/sh
2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4 # Test of gettext facilities in the YCP language.
5
6 cat <<\EOF > prog.ycp
7 {
8   textdomain "prog";
9
10   print (_("'Your command, please?', asked the waiter."));
11   print (sformat (_("a piece of cake", "%1 pieces of cake", n), n));
12   print (sformat (_("%1 is replaced by %2."), "FF", "EUR"));
13 }
14 EOF
15
16 : ${XGETTEXT=xgettext}
17 ${XGETTEXT} -o prog.tmp --omit-header --no-location prog.ycp || exit 1
18 LC_ALL=C tr -d '\r' < prog.tmp > prog.pot || exit 1
19
20 cat <<EOF > prog.ok
21 msgid "'Your command, please?', asked the waiter."
22 msgstr ""
23
24 #, ycp-format
25 msgid "a piece of cake"
26 msgid_plural "%1 pieces of cake"
27 msgstr[0] ""
28 msgstr[1] ""
29
30 #, ycp-format
31 msgid "%1 is replaced by %2."
32 msgstr ""
33 EOF
34
35 : ${DIFF=diff}
36 ${DIFF} prog.ok prog.pot || exit 1
37
38 cat <<\EOF > fr.po
39 msgid ""
40 msgstr ""
41 "Content-Type: text/plain; charset=ISO-8859-1\n"
42 "Plural-Forms: nplurals=2; plural=(n > 1);\n"
43
44 msgid "'Your command, please?', asked the waiter."
45 msgstr "«Votre commande, s'il vous plait», dit le garçon."
46
47 # Les gateaux allemands sont les meilleurs du monde.
48 #, ycp-format
49 msgid "a piece of cake"
50 msgid_plural "%1 pieces of cake"
51 msgstr[0] "un morceau de gateau"
52 msgstr[1] "%1 morceaux de gateau"
53
54 # Reverse the arguments.
55 #, ycp-format
56 msgid "%1 is replaced by %2."
57 msgstr "%2 remplace %1."
58 EOF
59
60 : ${MSGMERGE=msgmerge}
61 ${MSGMERGE} -q -o fr.po.tmp fr.po prog.pot || exit 1
62 LC_ALL=C tr -d '\r' < fr.po.tmp > fr.po.new || exit 1
63
64 : ${DIFF=diff}
65 ${DIFF} fr.po fr.po.new || exit 1
66
67 exit 0