2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
4 # Test of gettext facilities in the GNU awk language.
5 # Assumes an fr_FR locale is installed.
6 # Assumes the following packages are installed: gawk.
8 # Note: This test fails on MacOS X 10.3.5 (Darwin 7.5) in the fr_FR locale
9 # but not in the fr_FR.UTF-8 locale. Probably because in the fr_FR locale,
10 # nl_langinfo(CODESET) returns "".
17 print _"'Your command, please?', asked the waiter."
19 printf dcngettext ("a piece of cake", "%d pieces of cake", n) "\n", n
21 printf _"%s is replaced by %s." "\n", "FF", "EUR"
25 : ${XGETTEXT=xgettext}
26 ${XGETTEXT} -o prog.tmp --omit-header --no-location prog.awk || exit 1
27 LC_ALL=C tr -d '\r' < prog.tmp > prog.pot || exit 1
30 msgid "'Your command, please?', asked the waiter."
34 msgid "a piece of cake"
35 msgid_plural "%d pieces of cake"
40 msgid "%s is replaced by %s."
45 ${DIFF} prog.ok prog.pot || exit 1
50 "Content-Type: text/plain; charset=ISO-8859-1\n"
51 "Plural-Forms: nplurals=2; plural=(n > 1);\n"
53 msgid "'Your command, please?', asked the waiter."
54 msgstr "«Votre commande, s'il vous plait», dit le garçon."
56 # Les gateaux allemands sont les meilleurs du monde.
58 msgid "a piece of cake"
59 msgid_plural "%d pieces of cake"
60 msgstr[0] "un morceau de gateau"
61 msgstr[1] "%d morceaux de gateau"
63 # Reverse the arguments.
65 msgid "%s is replaced by %s."
66 msgstr "%2$s remplace %1$s."
69 : ${MSGMERGE=msgmerge}
70 ${MSGMERGE} -q -o fr.po.tmp fr.po prog.pot || exit 1
71 LC_ALL=C tr -d '\r' < fr.po.tmp > fr.po.new || exit 1
74 ${DIFF} fr.po fr.po.new || exit 1
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 for presence of gawk version 3.1.3 or newer, excluding version 3.1.5.
83 (gawk --version) >/dev/null 2>/dev/null \
84 || { echo "Skipping test: gawk not found"; exit 77; }
85 case `gawk --version 2>&1 | sed -e 's/^[^0-9]*//'` in
86 0.* | 1.* | 2.* | 3.0* | 3.1.0* | 3.1.1* | 3.1.2* | 3.1.5*)
87 echo "Skipping test: gawk version too old"; exit 77;;
90 # Test which of the fr_FR locales are installed.
92 : ${LOCALE_FR_UTF8=fr_FR.UTF-8}
93 if test $LOCALE_FR != none; then
94 LC_ALL=$LOCALE_FR ../testlocale
101 if test $LOCALE_FR_UTF8 != none; then
102 LC_ALL=$LOCALE_FR_UTF8 ../testlocale
105 77) LOCALE_FR_UTF8=none;;
109 if test $LOCALE_FR = none && test $LOCALE_FR_UTF8 = none; then
110 if test -f /usr/bin/localedef; then
111 echo "Skipping test: no french locale is installed"
113 echo "Skipping test: no french locale is supported"
118 # Test that gawk wasn't built with --disable-nls.
120 : ${LOCALE_FR_UTF8=fr_FR.UTF-8}
121 if test $LOCALE_FR != none; then
122 LANGUAGE= LC_ALL=$LOCALE_FR gawk --version | grep logiciel > /dev/null
124 echo "Skipping test: gawk was built without i18n support"
128 if test $LOCALE_FR_UTF8 != none; then
129 LANGUAGE= LC_ALL=$LOCALE_FR_UTF8 gawk --version | grep logiciel > /dev/null
131 echo "Skipping test: gawk was built without i18n support"
138 «Votre commande, s'il vous plait», dit le garçon.
142 cat <<\EOF > prog.oku
143 «Votre commande, s'il vous plait», dit le garçon.
149 : ${LOCALE_FR_UTF8=fr_FR.UTF-8}
150 if test $LOCALE_FR != none; then
151 prepare_locale_ fr $LOCALE_FR
152 LANGUAGE= LC_ALL=$LOCALE_FR gawk -v n=2 -f prog.awk > prog.out || exit 1
153 ${DIFF} prog.ok prog.out || exit 1
155 if test $LOCALE_FR_UTF8 != none; then
156 prepare_locale_ fr $LOCALE_FR_UTF8
157 LANGUAGE= LC_ALL=$LOCALE_FR_UTF8 gawk -v n=2 -f prog.awk > prog.out || exit 1
158 ${DIFF} prog.oku prog.out || exit 1