3 # Test of gettext facilities in the Object Pascal language.
4 # Assumes the following packages are installed: fpk.
6 # Note: This test fails with fpk 1.0.10 when an UTF-8 locale is present,
7 # because fpk ignores the locale's encoding. It supports only unibyte locales.
8 # This here is a quick workaround:
12 trap 'rm -fr $tmpfiles' 1 2 3 15
14 tmpfiles
="$tmpfiles prog.pp"
19 uses
gettext, sysutils
;
22 question
= '''Your command, please?'', asked the waiter.';
23 currencies
= '%s is replaced by %s.';
26 translateresourcestrings
('%s/LC_MESSAGES/prog.mo');
28 writeln
(format
(currencies
, ['FF', 'EUR']));
32 tmpfiles
="$tmpfiles prog.o prog.rst prog"
33 (ppc386 prog.pp
) >/dev
/null
2>&1 ||
{ rm -fr $tmpfiles; exit 77; }
35 tmpfiles
="$tmpfiles prog.pot"
36 : ${XGETTEXT=xgettext}
37 ${XGETTEXT} -o prog.pot
--omit-header --add-location prog.rst
39 tmpfiles
="$tmpfiles prog.ok"
42 msgid "'Your command, please?', asked the waiter."
46 #, object-pascal-format
47 msgid "%s is replaced by %s."
52 ${DIFF} prog.ok prog.pot ||
exit 1
54 tmpfiles
="$tmpfiles fr.po"
57 msgstr
"Content-Type: text/plain; charset=ISO-8859-1\n"
60 msgid
"'Your command, please?', asked the waiter."
61 msgstr
"«Votre commande, s'il vous plait», dit le garçon."
63 # Reverse the arguments.
65 #, object-pascal-format
66 msgid
"%s is replaced by %s."
67 msgstr
"%1:s remplace %0:s."
70 tmpfiles
="$tmpfiles fr.po.new"
71 : ${MSGMERGE=msgmerge}
72 ${MSGMERGE} -q -o fr.po.new fr.po prog.pot
75 ${DIFF} fr.po fr.po.new ||
exit 1
77 tmpfiles
="$tmpfiles fr"
78 test -d fr || mkdir fr
79 test -d fr
/LC_MESSAGES || mkdir fr
/LC_MESSAGES
82 ${MSGFMT} -o fr
/LC_MESSAGES
/prog.mo fr.po
84 tmpfiles
="$tmpfiles prog.ok prog.oku prog.out"
87 «Votre commande
, s
'il vous plait», dit le garçon.
91 «Votre commande, s'il vous plait»
, dit le garçon.
96 : ${LOCALE_FR_UTF8=fr_FR.UTF-8}
97 if test $LOCALE_FR != none
; then
98 LANGUAGE
= LC_ALL
= LC_MESSAGES
= LC_CTYPE
= LANG
=$LOCALE_FR .
/prog
> prog.out ||
exit 1
100 ${DIFF} prog.ok prog.out ||
exit 1
102 if test $LOCALE_FR_UTF8 != none
; then
103 LANGUAGE
= LC_ALL
= LC_MESSAGES
= LC_CTYPE
= LANG
=$LOCALE_FR_UTF8 .
/prog
> prog.out ||
exit 1
105 ${DIFF} prog.oku prog.out ||
exit 1
107 if test $LOCALE_FR = none
&& test $LOCALE_FR_UTF8 = none
; then
108 rm -fr $tmpfiles; exit 77