2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
4 # Test of gettext facilities in the C# language.
5 # Assumes an fr_FR locale is installed.
6 # Assumes the following packages are installed: pnet, pnetlib.
8 # Note: This test fails with mono-0.28 because the CultureInfo.Parent pointers
9 # are wrong for locales containing a language and a territory. This is fixed
12 # Test whether we can build and test C# programs.
13 test "${CSHARP_CHOICE}" != no || {
14 echo "Skipping test: configured with --disable-csharp"
17 test "${BUILDCSHARP}" = yes || {
18 echo "Skipping test: C# compiler not found"
21 test "${TESTCSHARP}" = yes || {
22 echo "Skipping test: C# engine not found"
26 cat <<\EOF > program.cs
30 static void Main (String[] args) {
32 // Some systems don't set CurrentCulture and CurrentUICulture as specified
33 // by LC_ALL. So set it by hand.
34 System.Threading.Thread.CurrentThread.CurrentCulture =
35 System.Threading.Thread.CurrentThread.CurrentUICulture =
36 new System.Globalization.CultureInfo("fr-FR");
38 int n = Int32.Parse(args[0]);
39 GettextResourceManager catalog = new GettextResourceManager("prog");
40 Console.WriteLine(catalog.GetString("'Your command, please?', asked the waiter."));
41 Console.WriteLine(String.Format(catalog.GetPluralString("a piece of cake","{0} pieces of cake",n), n));
42 Console.WriteLine(String.Format(catalog.GetString("{0} is replaced by {1}."), "FF", "EUR"));
43 Console.WriteLine(String.Format(catalog.GetParticularPluralString("++","a piece of cake","{0} pieces of cake",n), n));
44 Console.WriteLine(String.Format(catalog.GetParticularString("++","{0} is replaced by {1}."), "FF", "EUR"));
49 : ${CSHARPCOMP="/bin/sh ../../csharpcomp.sh"}
50 ${CSHARPCOMP} -o program.exe -L ../../../gettext-runtime/intl-csharp -l GNU.Gettext program.cs || exit 1
52 : ${XGETTEXT=xgettext}
53 ${XGETTEXT} -o prog.tmp --omit-header --no-location program.cs || exit 1
54 LC_ALL=C tr -d '\r' < prog.tmp > prog.pot || exit 1
57 msgid "'Your command, please?', asked the waiter."
61 msgid "a piece of cake"
62 msgid_plural "{0} pieces of cake"
67 msgid "{0} is replaced by {1}."
72 msgid "a piece of cake"
73 msgid_plural "{0} pieces of cake"
79 msgid "{0} is replaced by {1}."
84 ${DIFF} prog.ok prog.pot || exit 1
89 "Content-Type: text/plain; charset=ISO-8859-1\n"
90 "Plural-Forms: nplurals=2; plural=(n > 1);\n"
92 msgid "'Your command, please?', asked the waiter."
93 msgstr "«Votre commande, s'il vous plait», dit le garçon."
95 # Les gateaux allemands sont les meilleurs du monde.
97 msgid "a piece of cake"
98 msgid_plural "{0} pieces of cake"
99 msgstr[0] "un morceau de gateau"
100 msgstr[1] "{0} morceaux de gateau"
102 # Reverse the arguments.
104 msgid "{0} is replaced by {1}."
105 msgstr "{1} remplace {0}."
107 # Euphemistic formulation.
110 msgid "a piece of cake"
111 msgid_plural "{0} pieces of cake"
112 msgstr[0] "un morceau de gateau succulent"
113 msgstr[1] "{0} morceaux de gateau succulent"
115 # Euphemistic formulation.
118 msgid "{0} is replaced by {1}."
119 msgstr "Le nouveau {1} remplace le vieux {0}."
122 : ${MSGMERGE=msgmerge}
123 ${MSGMERGE} -q -o fr.po.tmp fr.po prog.pot || exit 1
124 LC_ALL=C tr -d '\r' < fr.po.tmp > fr.po.new || exit 1
127 ${DIFF} fr.po fr.po.new || exit 1
130 GETTEXTCSHARPLIBDIR=../../../gettext-runtime/intl-csharp \
131 ${MSGFMT} --csharp -d . -r prog -l fr fr.po || exit 1
133 # Test which of the fr_FR locales are installed.
135 : ${LOCALE_FR_UTF8=fr_FR.UTF-8}
136 if test $LOCALE_FR != none; then
137 LC_ALL=$LOCALE_FR ../testlocale
144 if test $LOCALE_FR_UTF8 != none; then
145 LC_ALL=$LOCALE_FR_UTF8 ../testlocale
148 77) LOCALE_FR_UTF8=none;;
152 if test $LOCALE_FR = none && test $LOCALE_FR_UTF8 = none; then
153 if test -f /usr/bin/localedef; then
154 echo "Skipping test: no french locale is installed"
156 echo "Skipping test: no french locale is supported"
163 «Votre commande, s'il vous plait», dit le garçon.
166 2 morceaux de gateau succulent
167 Le nouveau EUR remplace le vieux FF.
169 cat <<\EOF > prog.oku
170 «Votre commande, s'il vous plait», dit le garçon.
173 2 morceaux de gateau succulent
174 Le nouveau EUR remplace le vieux FF.
178 : ${LOCALE_FR_UTF8=fr_FR.UTF-8}
179 : ${CSHARPEXEC="/bin/sh ../../csharpexec.sh"}
180 if test $LOCALE_FR != none; then
181 prepare_locale_ fr $LOCALE_FR
182 LANGUAGE= LC_ALL=$LOCALE_FR ${CSHARPEXEC} -L ../../../gettext-runtime/intl-csharp program.exe 2 > prog.out || exit 1
183 ${DIFF} prog.ok prog.out || exit 1
185 if test $LOCALE_FR_UTF8 != none; then
186 prepare_locale_ fr $LOCALE_FR_UTF8
187 LANGUAGE= LC_ALL=$LOCALE_FR_UTF8 ${CSHARPEXEC} -L ../../../gettext-runtime/intl-csharp program.exe 2 > prog.out || exit 1
188 ${DIFF} prog.oku prog.out || exit 1