1#! /bin/sh
2. "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4# Test filling Plural-Forms: with Unicode CLDR
5
6LC_ALL=C "$top_builddir/src/cldr-plurals" ru /dev/null 2>&1 | grep 'extraction is not supported' > /dev/null 2>&1
7test $? = 0 && {
8  echo "Skipping test: cldr-plurals was built without XML support"
9  Exit 77
10}
11
12cat <<\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
19msgid ""
20msgstr ""
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
32msgid "'Your command, please?', asked the waiter."
33msgstr ""
34
35#, c-format
36msgid "a piece of cake"
37msgid_plural "%d pieces of cake"
38msgstr[0] ""
39msgstr[1] ""
40
41#, c-format
42msgid "%s is replaced by %s."
43msgstr ""
44EOF
45
46: ${MSGINIT=msginit}
47GETTEXTLIBDIR_SRCDIR="$wabs_top_srcdir"/src \
48GETTEXTLIBDIR_BUILDDIR="$top_builddir"/src \
49GETTEXTCLDRDIR="$wabs_srcdir" \
50${MSGINIT} -i mi-test4.pot -l foo --no-translator --no-wrap -o mi-test4.tmp 2>mi-test4.err
51test $? = 0 || { cat mi-test4.err 1>&2; Exit 1; }
52
53# The charset stored in the header entry is the locale encoding of the gl_IE
54# locale, which is system dependent, or ASCII if the locale does not exist.
55#
56# Project-Id-Version contains version constructed from a temporary
57# directory name
58sed -e '1,10d' -e 's/ISO-8859-1/ASCII/g' -e 's/CP1252/ASCII/g' -e 's/UTF-8/ASCII/g' < mi-test4.tmp | grep -v Project-Id-Version | LC_ALL=C tr -d '\r' > mi-test4.out || Exit 1
59cat <<\EOF > mi-test4.ok
60"Last-Translator: Automatically generated\n"
61"Language-Team: none\n"
62"Language: foo\n"
63"MIME-Version: 1.0\n"
64"Content-Type: text/plain; charset=ASCII\n"
65"Content-Transfer-Encoding: 8bit\n"
66"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"
67
68#, c-format
69msgid "'Your command, please?', asked the waiter."
70msgstr ""
71
72#, c-format
73msgid "a piece of cake"
74msgid_plural "%d pieces of cake"
75msgstr[0] ""
76msgstr[1] ""
77msgstr[2] ""
78
79#, c-format
80msgid "%s is replaced by %s."
81msgstr ""
82EOF
83
84: ${DIFF=diff}
85${DIFF} mi-test4.ok mi-test4.out
86result=$?
87
88exit $result
89