3 # Test of gettext facilities in the Objective C language.
4 # Assumes an fr_FR locale is installed.
5 # Assumes the following packages are installed: gcc.
8 trap 'rm -fr $tmpfiles' 1 2 3 15
10 # Test whether an ObjectiveC compiler is found.
11 tmpfiles
="$tmpfiles hello.m hello.${OBJEXT} hello${EXEEXT}"
17 printf ("Hello world\n");
21 ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} -o hello hello.m
2>/dev
/null \
22 ||
{ rm -fr $tmpfiles; exit 77; }
24 tmpfiles
="$tmpfiles prog.m"
32 #define _(string) gettext (string)
34 int main
(int argc
, char
*argv
[])
36 int n
= atoi
(argv
[2]);
38 xsetenv
("LC_ALL", argv
[1], 1);
39 if (setlocale
(LC_ALL
, "") == NULL
)
41 fprintf
(stderr
, "Couldn't set locale.\n");
46 bindtextdomain
("prog", ".");
48 printf (_
("'Your command, please?', asked the waiter."));
51 printf (ngettext
("a piece of cake", "%d pieces of cake", n
), n
);
54 printf (_
("%s is replaced by %s."), "FF", "EUR");
61 # Variable needed by LTLIBINTL.
64 tmpfiles
="$tmpfiles prog.${OBJEXT} prog${EXEEXT}"
65 ${LIBTOOL} --quiet --mode=link ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} -o prog prog.m -I.. -I$top_srcdir/lib ../lib/libgettextlib.la -I../intl ${LTLIBINTL} \
68 tmpfiles
="$tmpfiles prog.pot"
69 : ${XGETTEXT=xgettext}
70 ${XGETTEXT} -o prog.pot
--omit-header --no-location -k_ prog.m
72 tmpfiles
="$tmpfiles prog.ok"
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
92 tmpfiles
="$tmpfiles fr.po"
96 "Content-Type: text/plain; charset=ISO-8859-1\n"
97 "Plural-Forms: nplurals=2; plural=(n > 1);\n"
100 msgid
"'Your command, please?', asked the waiter."
101 msgstr
"«Votre commande, s'il vous plait», dit le garçon."
103 # Les gateaux allemands sont les meilleurs du monde.
105 msgid
"a piece of cake"
106 msgid_plural
"%d pieces of cake"
107 msgstr
[0] "un morceau de gateau"
108 msgstr
[1] "%d morceaux de gateau"
110 # Reverse the arguments.
112 msgid
"%s is replaced by %s."
113 msgstr
"%2$s remplace %1$s."
116 tmpfiles
="$tmpfiles fr.po.new"
117 : ${MSGMERGE=msgmerge}
118 ${MSGMERGE} -q -o fr.po.new fr.po prog.pot
121 ${DIFF} fr.po fr.po.new ||
exit 1
123 tmpfiles
="$tmpfiles fr"
124 test -d fr || mkdir fr
125 test -d fr
/LC_MESSAGES || mkdir fr
/LC_MESSAGES
128 ${MSGFMT} -o fr
/LC_MESSAGES
/prog.mo fr.po
130 tmpfiles
="$tmpfiles prog.ok prog.oku prog.out"
133 «Votre commande
, s
'il vous plait», dit le garçon.
137 cat <<\EOF > prog.oku
138 «Votre commande, s'il vous plait»
, dit le garçon.
144 : ${LOCALE_FR_UTF8=fr_FR.UTF-8}
145 if test $LOCALE_FR != none
; then
146 LANGUAGE
= .
/prog
$LOCALE_FR 2 > prog.out
148 0) ${DIFF} prog.ok prog.out ||
exit 1;;
153 if test $LOCALE_FR_UTF8 != none
; then
154 LANGUAGE
= .
/prog
$LOCALE_FR_UTF8 2 > prog.out
156 0) ${DIFF} prog.oku prog.out ||
exit 1;;
157 77) LOCALE_FR_UTF8
=none
;;
161 if test $LOCALE_FR = none
&& test $LOCALE_FR_UTF8 = none
; then
162 rm -fr $tmpfiles; exit 77