2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
4 # Test of gettext facilities in the Object Pascal language.
5 # Assumes the following packages are installed: fpk.
7 # Note: This test fails with fpk 1.0.10 when an UTF-8 locale is present,
8 # because fpk ignores the locale's encoding. It supports only unibyte locales.
9 # This here is a quick workaround:
10 UTF8_LOCALE_UNSUPPORTED=yes
12 cat <<\EOF > pascalprog.pp
16 uses gettext, sysutils;
19 question = '''Your command, please?'', asked the waiter.';
20 currencies = '%s is replaced by %s.';
23 translateresourcestrings('%s/LC_MESSAGES/pascalprog.mo');
25 writeln(format(currencies, ['FF', 'EUR']));
29 (ppc386 pascalprog.pp) >/dev/null 2>&1 ||
30 (ppcx64 pascalprog.pp) >/dev/null 2>&1 ||
32 echo "Skipping test: Pascal compiler ppc386 or ppcx64 not found"
36 : ${XGETTEXT=xgettext}
37 ${XGETTEXT} -o pascalprog.tmp --omit-header --add-location pascalprog.rst || exit 1
38 LC_ALL=C tr -d '\r' < pascalprog.tmp > pascalprog.pot || exit 1
40 cat <<EOF > pascalprog.ok
41 #: pascalprog.question
42 msgid "'Your command, please?', asked the waiter."
45 #: pascalprog.currencies
46 #, object-pascal-format
47 msgid "%s is replaced by %s."
52 ${DIFF} pascalprog.ok pascalprog.pot || exit 1
56 msgstr "Content-Type: text/plain; charset=ISO-8859-1\n"
58 #: pascalprog.question
59 msgid "'Your command, please?', asked the waiter."
60 msgstr "«Votre commande, s'il vous plait», dit le garçon."
62 # Reverse the arguments.
63 #: pascalprog.currencies
64 #, object-pascal-format
65 msgid "%s is replaced by %s."
66 msgstr "%1:s remplace %0:s."
69 : ${MSGMERGE=msgmerge}
70 ${MSGMERGE} -q -o fr.po.tmp fr.po pascalprog.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/pascalprog.mo fr.po
83 cat <<\EOF > pascalprog.ok
84 «Votre commande, s'il vous plait», dit le garçon.
87 cat <<\EOF > pascalprog.oku
88 «Votre commande, s'il vous plait», dit le garçon.
93 : ${LOCALE_FR_UTF8=fr_FR.UTF-8}
94 if test $LOCALE_FR != none; then
95 prepare_locale_ fr $LOCALE_FR
96 LANGUAGE= LC_ALL= LC_MESSAGES= LC_CTYPE= LANG=$LOCALE_FR ./pascalprog > pascalprog.out || exit 1
98 ${DIFF} pascalprog.ok pascalprog.out || exit 1
100 if test -z "$UTF8_LOCALE_UNSUPPORTED"; then
101 if test $LOCALE_FR_UTF8 != none; then
102 prepare_locale_ fr $LOCALE_FR_UTF8
103 LANGUAGE= LC_ALL= LC_MESSAGES= LC_CTYPE= LANG=$LOCALE_FR_UTF8 ./pascalprog > pascalprog.out || exit 1
105 ${DIFF} pascalprog.oku pascalprog.out || exit 1
107 if test $LOCALE_FR = none && test $LOCALE_FR_UTF8 = none; then
108 if test -f /usr/bin/localedef; then
109 echo "Skipping test: no french locale is installed"
111 echo "Skipping test: no french locale is supported"
116 if test $LOCALE_FR = none; then
117 if test -f /usr/bin/localedef; then
118 echo "Skipping test: no traditional french locale is installed"
120 echo "Skipping test: no traditional french locale is supported"