3 # Test of gettext facilities in the sh language.
4 # Assumes an fr_FR locale is installed.
5 # Assumes the following packages are installed: bash.
7 # Note: This test fails on BeOS because there all locales use the UTF-8
8 # encoding, even the locale fr_FR, thus the output comes out in UTF-8.
11 trap 'rm -fr $tmpfiles' 1 2 3 15
13 tmpfiles
="$tmpfiles prog.sh"
26 $echo "`gettext \"'Your command, please?', asked the waiter.\"`"
28 $echo "`eval_ngettext \"a piece of cake\" \"\\$n pieces of cake\" $n`"
31 tmpfiles
="$tmpfiles prog.pot"
32 : ${XGETTEXT=xgettext}
33 ${XGETTEXT} -o prog.pot
--omit-header --no-location prog.sh
35 tmpfiles
="$tmpfiles prog.ok"
37 msgid
"'Your command, please?', asked the waiter."
41 msgid
"a piece of cake"
42 msgid_plural
"$n pieces of cake"
48 ${DIFF} prog.ok prog.pot ||
exit 1
50 tmpfiles
="$tmpfiles fr.po"
54 "Content-Type: text/plain; charset=ISO-8859-1\n"
55 "Plural-Forms: nplurals=2; plural=(n > 1);\n"
57 msgid
"'Your command, please?', asked the waiter."
58 msgstr
"«Votre commande, s'il vous plait», dit le garçon."
60 # Les gateaux allemands sont les meilleurs du monde.
62 msgid
"a piece of cake"
63 msgid_plural
"$n pieces of cake"
64 msgstr
[0] "un morceau de gateau"
65 msgstr
[1] "$n morceaux de gateau"
68 tmpfiles
="$tmpfiles fr.po.new"
69 : ${MSGMERGE=msgmerge}
70 ${MSGMERGE} -q -o fr.po.new fr.po prog.pot
73 ${DIFF} fr.po fr.po.new ||
exit 1
75 tmpfiles
="$tmpfiles fr"
76 test -d fr || mkdir fr
77 test -d fr
/LC_MESSAGES || mkdir fr
/LC_MESSAGES
80 ${MSGFMT} -o fr
/LC_MESSAGES
/prog.mo fr.po
82 # Test which of the fr_FR locales are installed.
84 : ${LOCALE_FR_UTF8=fr_FR.UTF-8}
85 if test $LOCALE_FR != none
; then
86 LC_ALL
=$LOCALE_FR .
/testlocale
93 if test $LOCALE_FR_UTF8 != none
; then
94 LC_ALL
=$LOCALE_FR_UTF8 .
/testlocale
97 77) LOCALE_FR_UTF8
=none
;;
101 if test $LOCALE_FR = none
&& test $LOCALE_FR_UTF8 = none
; then
102 rm -fr $tmpfiles; exit 77
105 tmpfiles
="$tmpfiles prog.ok prog.oku prog.out"
108 «Votre commande
, s
'il vous plait», dit le garçon.
111 cat <<\EOF > prog.oku
112 «Votre commande, s'il vous plait»
, dit le garçon.
117 : ${LOCALE_FR_UTF8=fr_FR.UTF-8}
118 if test $LOCALE_FR != none
; then
119 LANGUAGE
= LC_ALL
=$LOCALE_FR sh .
/prog.sh
2 > prog.out ||
exit 1
120 ${DIFF} prog.ok prog.out ||
exit 1
122 if test $LOCALE_FR_UTF8 != none
; then
123 LANGUAGE
= LC_ALL
=$LOCALE_FR_UTF8 sh .
/prog.sh
2 > prog.out ||
exit 1
124 ${DIFF} prog.oku prog.out ||
exit 1