3 # Test of gettext facilities in the C# language.
4 # Assumes an fr_FR locale is installed.
5 # Assumes the following packages are installed: pnet, pnetlib.
7 # Note: This test fails with mono-0.28 because the CultureInfo.Parent pointers
8 # are wrong for locales containing a language and a territory. This is fixed
12 trap 'rm -fr $tmpfiles' 1 2 3 15
14 # Test whether we can build and test C# programs.
15 test "${TESTCSHARP}" = yes ||
exit 77
17 tmpfiles
="$tmpfiles program.cs"
18 cat <<\EOF
> program.cs
22 static void Main
(String
[] args
) {
24 // Some systems don
't set CurrentCulture and CurrentUICulture as specified
25 // by LC_ALL. So set it by hand.
26 System.Threading.Thread.CurrentThread.CurrentCulture =
27 System.Threading.Thread.CurrentThread.CurrentUICulture =
28 new System.Globalization.CultureInfo("fr-FR");
30 int n = Int32.Parse(args[0]);
31 GettextResourceManager catalog = new GettextResourceManager("prog");
32 Console.WriteLine(catalog.GetString("'Your
command, please?
', asked the waiter."));
33 Console.WriteLine(String.Format(catalog.GetPluralString("a piece of cake","{0} pieces of cake",n), n));
34 Console.WriteLine(String.Format(catalog.GetString("{0} is replaced by {1}."), "FF", "EUR"));
39 tmpfiles="$tmpfiles program.exe"
40 : ${CSHARPCOMP="/bin/sh ../lib/csharpcomp.sh"}
41 ${CSHARPCOMP} -o program.exe -L ../../gettext-runtime/intl-csharp -l GNU.Gettext program.cs || exit 1
43 tmpfiles="$tmpfiles prog.pot"
44 : ${XGETTEXT=xgettext}
45 ${XGETTEXT} -o prog.pot --omit-header --no-location program.cs
47 tmpfiles="$tmpfiles prog.ok"
49 msgid "'Your
command, please?
', asked the waiter."
53 msgid "a piece of cake"
54 msgid_plural "{0} pieces of cake"
59 msgid "{0} is replaced by {1}."
64 ${DIFF} prog.ok prog.pot || exit 1
66 tmpfiles="$tmpfiles fr.po"
70 "Content-Type: text/plain; charset=ISO-8859-1\n"
71 "Plural-Forms: nplurals=2; plural=(n > 1);\n"
73 msgid "'Your
command, please?
', asked the waiter."
74 msgstr "«Votre commande, s'il vous plait»
, dit le garçon.
"
76 # Les gateaux allemands sont les meilleurs du monde.
78 msgid "a piece of cake
"
79 msgid_plural "{0} pieces of cake
"
80 msgstr[0] "un morceau de gateau
"
81 msgstr[1] "{0} morceaux de gateau
"
83 # Reverse the arguments.
85 msgid "{0} is replaced by
{1}.
"
86 msgstr "{1} remplace
{0}.
"
89 tmpfiles="$tmpfiles fr.po.new
"
90 : ${MSGMERGE=msgmerge}
91 ${MSGMERGE} -q -o fr.po.new fr.po prog.pot
94 ${DIFF} fr.po fr.po.new || exit 1
96 tmpfiles="$tmpfiles fr
/prog.dll
"
98 GETTEXTCSHARPLIBDIR=../../gettext-runtime/intl-csharp \
99 ${MSGFMT} --csharp -d . -r prog -l fr fr.po || exit 1
101 # Test which of the fr_FR locales are installed.
103 : ${LOCALE_FR_UTF8=fr_FR.UTF-8}
104 if test $LOCALE_FR != none; then
105 LC_ALL=$LOCALE_FR ./testlocale
112 if test $LOCALE_FR_UTF8 != none; then
113 LC_ALL=$LOCALE_FR_UTF8 ./testlocale
116 77) LOCALE_FR_UTF8=none;;
120 if test $LOCALE_FR = none && test $LOCALE_FR_UTF8 = none; then
121 rm -fr $tmpfiles; exit 77
124 tmpfiles="$tmpfiles prog.ok prog.oku prog.out
"
127 «Votre commande, s'il vous plait», dit le garçon.
131 cat <<\EOF > prog.oku
132 «Votre commande, s'il vous plait», dit le garçon.
138 : ${LOCALE_FR_UTF8=fr_FR.UTF-8}
139 : ${CSHARPEXEC="/bin/sh ../lib/csharpexec.sh"}
140 if test $LOCALE_FR != none; then
141 LANGUAGE= LC_ALL=$LOCALE_FR ${CSHARPEXEC} -L ../../gettext-runtime/intl-csharp program.exe 2 > prog.out || exit 1
142 ${DIFF} prog.ok prog.out || exit 1
144 if test $LOCALE_FR_UTF8 != none; then
145 LANGUAGE= LC_ALL=$LOCALE_FR_UTF8 ${CSHARPEXEC} -L ../../gettext-runtime/intl-csharp program.exe 2 > prog.out || exit 1
146 ${DIFF} prog.oku prog.out || exit 1