No empty .Rs/.Re
[netbsd-mini2440.git] / gnu / dist / gettext / gettext-tools / tests / lang-pascal
blob46cb24aafe7335e0c12280f375c81524eac424ce
1 #! /bin/sh
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:
9 LOCALE_FR_UTF8=none
11 tmpfiles=""
12 trap 'rm -fr $tmpfiles' 1 2 3 15
14 tmpfiles="$tmpfiles prog.pp"
15 cat <<\EOF > prog.pp
16 program prog;
17 {$mode delphi}
19 uses gettext, sysutils;
21 resourcestring
22 question = '''Your command, please?'', asked the waiter.';
23 currencies = '%s is replaced by %s.';
25 begin
26 translateresourcestrings('%s/LC_MESSAGES/prog.mo');
27 writeln(question);
28 writeln(format(currencies, ['FF', 'EUR']));
29 end.
30 EOF
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"
40 cat <<EOF > prog.ok
41 #: prog.question
42 msgid "'Your command, please?', asked the waiter."
43 msgstr ""
45 #: prog.currencies
46 #, object-pascal-format
47 msgid "%s is replaced by %s."
48 msgstr ""
49 EOF
51 : ${DIFF=diff}
52 ${DIFF} prog.ok prog.pot || exit 1
54 tmpfiles="$tmpfiles fr.po"
55 cat <<\EOF > fr.po
56 msgid ""
57 msgstr "Content-Type: text/plain; charset=ISO-8859-1\n"
59 #: prog.question
60 msgid "'Your command, please?', asked the waiter."
61 msgstr "«Votre commande, s'il vous plait», dit le garçon."
63 # Reverse the arguments.
64 #: prog.currencies
65 #, object-pascal-format
66 msgid "%s is replaced by %s."
67 msgstr "%1:s remplace %0:s."
68 EOF
70 tmpfiles="$tmpfiles fr.po.new"
71 : ${MSGMERGE=msgmerge}
72 ${MSGMERGE} -q -o fr.po.new fr.po prog.pot
74 : ${DIFF=diff}
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
81 : ${MSGFMT=msgfmt}
82 ${MSGFMT} -o fr/LC_MESSAGES/prog.mo fr.po
84 tmpfiles="$tmpfiles prog.ok prog.oku prog.out"
85 : ${DIFF=diff}
86 cat <<\EOF > prog.ok
87 «Votre commande, s'il vous plait», dit le garçon.
88 EUR remplace FF.
89 EOF
90 cat <<\EOF > prog.oku
91 «Votre commande, s'il vous plait», dit le garçon.
92 EUR remplace FF.
93 EOF
95 : ${LOCALE_FR=fr_FR}
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
99 : ${DIFF=diff}
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
104 : ${DIFF=diff}
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
111 rm -fr $tmpfiles
113 exit 0