2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
4 # Test of gettext facilities in the Objective C language.
5 # Assumes an fr_FR locale is installed.
6 # Assumes the following packages are installed: gcc.
8 # Test whether an ObjectiveC compiler is found.
14 printf ("Hello world\n");
18 ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} -o hello hello.m 2>/dev/null \
19 || { echo "Skipping test: Objective C compiler not found"
30 #define _(string) gettext (string)
32 int main (int argc, char *argv[])
34 int n = atoi (argv[2]);
36 xsetenv ("LC_ALL", argv[1], 1);
37 if (setlocale (LC_ALL, "") == NULL)
38 /* Couldn't set locale. */
42 bindtextdomain ("prog", ".");
44 printf (_("'Your command, please?', asked the waiter."));
47 printf (ngettext ("a piece of cake", "%d pieces of cake", n), n);
50 printf (_("%s is replaced by %s."), "FF", "EUR");
57 # Put the -I flags before ${CFLAGS} ${CPPFLAGS}, to make sure that libintl.h
58 # is found in the build directory, regardless of -I options present in
59 # ${CFLAGS} or ${CPPFLAGS}.
60 ${CC} -I../.. -I"$abs_top_srcdir"/gnulib-lib -I../../intl ${CFLAGS} \
61 ${CPPFLAGS} -c prog.m || exit 1
63 : ${CONFIG_SHELL=${SHELL-/bin/sh}}
64 ${CONFIG_SHELL} "$top_builddir"/libtool --quiet --tag=CC --mode=link \
65 ${CC} ${CFLAGS} -o prog prog.${OBJEXT} \
66 ../../gnulib-lib/libgettextlib.la ${LDFLAGS} ${LTLIBINTL} \
69 : ${XGETTEXT=xgettext}
70 ${XGETTEXT} -o prog.tmp --omit-header --no-location -k_ prog.m || exit 1
71 LC_ALL=C tr -d '\r' < prog.tmp > prog.pot || exit 1
75 msgid "'Your command, please?', asked the waiter."
79 msgid "a piece of cake"
80 msgid_plural "%d pieces of cake"
85 msgid "%s is replaced by %s."
90 ${DIFF} prog.ok prog.pot || exit 1
95 "Content-Type: text/plain; charset=ISO-8859-1\n"
96 "Plural-Forms: nplurals=2; plural=(n > 1);\n"
99 msgid "'Your command, please?', asked the waiter."
100 msgstr "«Votre commande, s'il vous plait», dit le garçon."
102 # Les gateaux allemands sont les meilleurs du monde.
104 msgid "a piece of cake"
105 msgid_plural "%d pieces of cake"
106 msgstr[0] "un morceau de gateau"
107 msgstr[1] "%d morceaux de gateau"
109 # Reverse the arguments.
111 msgid "%s is replaced by %s."
112 msgstr "%2$s remplace %1$s."
115 : ${MSGMERGE=msgmerge}
116 ${MSGMERGE} -q -o fr.po.tmp fr.po prog.pot || exit 1
117 LC_ALL=C tr -d '\r' < fr.po.tmp > fr.po.new || exit 1
120 ${DIFF} fr.po fr.po.new || exit 1
122 test -d fr || mkdir fr
123 test -d fr/LC_MESSAGES || mkdir fr/LC_MESSAGES
126 ${MSGFMT} -o fr/LC_MESSAGES/prog.mo fr.po
130 «Votre commande, s'il vous plait», dit le garçon.
134 cat <<\EOF > prog.oku
135 «Votre commande, s'il vous plait», dit le garçon.
141 : ${LOCALE_FR_UTF8=fr_FR.UTF-8}
142 if test $LOCALE_FR != none; then
143 prepare_locale_ fr $LOCALE_FR
144 LANGUAGE= ./prog $LOCALE_FR 2 > prog.out
146 0) ${DIFF} prog.ok prog.out || exit 1;;
151 if test $LOCALE_FR_UTF8 != none; then
152 prepare_locale_ fr $LOCALE_FR_UTF8
153 LANGUAGE= ./prog $LOCALE_FR_UTF8 2 > prog.out
155 0) ${DIFF} prog.oku prog.out || exit 1;;
156 77) LOCALE_FR_UTF8=none;;
160 if test $LOCALE_FR = none && test $LOCALE_FR_UTF8 = none; then
161 if test -f /usr/bin/localedef; then
162 echo "Skipping test: no french locale is installed"
164 echo "Skipping test: no french locale is supported"