Imported Upstream version 0.19.7
[platform/upstream/gettext.git] / gettext-tools / tests / msginit-4
1 #! /bin/sh
2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4 # Test filling Plural-Forms: with Unicode CLDR
5
6 LC_ALL=C "$top_builddir/src/cldr-plurals" ru /dev/null 2>&1 | grep 'extraction is not supported' > /dev/null 2>&1
7 test $? = 0 && {
8   echo "Skipping test: cldr-plurals was built without XML support"
9   exit 77
10 }
11
12 cat <<\EOF > mi-test4.pot
13 # SOME DESCRIPTIVE TITLE.
14 # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
15 # This file is distributed under the same license as the PACKAGE package.
16 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
17 #
18 #, fuzzy
19 msgid ""
20 msgstr ""
21 "Project-Id-Version: PACKAGE VERSION\n"
22 "Report-Msgid-Bugs-To: \n"
23 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
24 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
25 "Language-Team: LANGUAGE <LL@li.org>\n"
26 "Language: \n"
27 "MIME-Version: 1.0\n"
28 "Content-Type: text/plain; charset=CHARSET\n"
29 "Content-Transfer-Encoding: 8bit\n"
30
31 #, c-format
32 msgid "'Your command, please?', asked the waiter."
33 msgstr ""
34
35 #, c-format
36 msgid "a piece of cake"
37 msgid_plural "%d pieces of cake"
38 msgstr[0] ""
39 msgstr[1] ""
40
41 #, c-format
42 msgid "%s is replaced by %s."
43 msgstr ""
44 EOF
45
46 : ${MSGINIT=msginit}
47 GETTEXTLIBDIR="$top_builddir"/src GETTEXTCLDRDIR="$abs_srcdir" ${MSGINIT} -l foo --no-translator --no-wrap -o mi-test4.tmp 2>mi-test4.err
48 test $? = 0 || { cat mi-test4.err 1>&2; exit 1; }
49
50 # The charset stored in the header entry is the locale encoding of the gl_IE
51 # locale, which is system dependent, or ASCII if the locale does not exist.
52 #
53 # Project-Id-Version contains version constructed from a temporary
54 # directory name
55 sed -e '1,10d' -e 's/\(ISO-8859-1\|CP1252\|UTF-8\)/ASCII/g' < mi-test4.tmp | grep -v Project-Id-Version | LC_ALL=C tr -d '\r' > mi-test4.out || exit 1
56 cat <<\EOF > mi-test4.ok
57 "Last-Translator: Automatically generated\n"
58 "Language-Team: none\n"
59 "Language: foo\n"
60 "MIME-Version: 1.0\n"
61 "Content-Type: text/plain; charset=ASCII\n"
62 "Content-Transfer-Encoding: 8bit\n"
63 "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : 2);\n"
64
65 #, c-format
66 msgid "'Your command, please?', asked the waiter."
67 msgstr ""
68
69 #, c-format
70 msgid "a piece of cake"
71 msgid_plural "%d pieces of cake"
72 msgstr[0] ""
73 msgstr[1] ""
74 msgstr[2] ""
75
76 #, c-format
77 msgid "%s is replaced by %s."
78 msgstr ""
79 EOF
80
81 : ${DIFF=diff}
82 ${DIFF} mi-test4.ok mi-test4.out
83 result=$?
84
85 exit $result