xref: /netbsd-src/external/gpl2/gettext/dist/gettext-tools/tests/msgunfmt-csharp-1 (revision 946379e7b37692fc43f68eb0d1c10daa0a7f3b6c)
1#! /bin/sh
2
3# Test of --csharp option.
4
5tmpfiles=""
6trap 'rm -fr $tmpfiles' 1 2 3 15
7
8# Test whether we can compile and execute C# programs.
9test "${CSHARP_CHOICE}" != no || {
10  echo "Skipping test: configured with --disable-csharp"
11  exit 77
12}
13test "${BUILDCSHARP}" = yes || {
14  echo "Skipping test: C# compiler not found"
15  exit 77
16}
17test "${TESTCSHARP}" = yes || {
18  echo "Skipping test: C# engine not found"
19  exit 77
20}
21
22tmpfiles="$tmpfiles fr.po"
23cat <<\EOF > fr.po
24msgid ""
25msgstr ""
26"Content-Type: text/plain; charset=ISO-8859-1\n"
27"Plural-Forms: nplurals=2; plural=(n > 1);\n"
28
29msgid "'Your command, please?', asked the waiter."
30msgstr "�Votre commande, s'il vous plait�, dit le gar�on."
31
32# Les gateaux allemands sont les meilleurs du monde.
33#, csharp-format
34msgid "a piece of cake"
35msgid_plural "{0} pieces of cake"
36msgstr[0] "un morceau de gateau"
37msgstr[1] "{0} morceaux de gateau"
38
39# Reverse the arguments.
40#, csharp-format
41msgid "{0} is replaced by {1}."
42msgstr "{1} remplace {0}."
43EOF
44
45tmpfiles="$tmpfiles fr/prog.resources.dll"
46: ${MSGFMT=msgfmt}
47GETTEXTCSHARPLIBDIR=../../gettext-runtime/intl-csharp \
48${MSGFMT} --csharp -d . -r prog -l fr fr.po || exit 1
49
50tmpfiles="$tmpfiles prog.out"
51: ${MSGUNFMT=msgunfmt}
52GETTEXTCSHARPEXEDIR=../src \
53GETTEXTCSHARPLIBDIR=../../gettext-runtime/intl-csharp \
54${MSGUNFMT} --csharp -d . -r prog -l fr -o prog.out || exit 1
55
56tmpfiles="$tmpfiles prog.sort"
57: ${MSGCAT=msgcat}
58${MSGCAT} -s -o prog.sort prog.out || exit 1
59
60tmpfiles="$tmpfiles prog.ok"
61cat <<\EOF > prog.ok
62msgid ""
63msgstr ""
64"Content-Type: text/plain; charset=UTF-8\n"
65"Plural-Forms: nplurals=2; plural=(n > 1);\n"
66
67msgid "'Your command, please?', asked the waiter."
68msgstr "«Votre commande, s'il vous plait», dit le garçon."
69
70msgid "a piece of cake"
71msgid_plural "{0} pieces of cake"
72msgstr[0] "un morceau de gateau"
73msgstr[1] "{0} morceaux de gateau"
74
75msgid "{0} is replaced by {1}."
76msgstr "{1} remplace {0}."
77EOF
78: ${DIFF=diff}
79${DIFF} prog.ok prog.sort || exit 1
80
81rm -fr $tmpfiles
82
83exit 0
84