No empty .Rs/.Re
[netbsd-mini2440.git] / gnu / dist / gettext / gettext-tools / tests / lang-smalltalk
blob31ff30543d8d475cf9c7c4b4e87ce608c02ed8ec
1 #! /bin/sh
3 # Test of gettext facilities in the GNU smalltalk language.
4 # Assumes an fr_FR locale is installed.
5 # Assumes the following packages are installed: smalltalk.
7 tmpfiles=""
8 trap 'rm -fr $tmpfiles' 1 2 3 15
10 tmpfiles="$tmpfiles prog.st"
11 cat <<\EOF > prog.st
12 PackageLoader fileInPackage: 'I18N' !
14 Object subclass: #Main
15 instanceVariableNames: ''
16 classVariableNames: 'NLS'
17 poolDictionaries: ''
18 category: 'Program'
20 !Main methodsFor: 'running'!
21 run
22 | n |
23 NLS := I18N Locale default messages domain: 'prog' localeDirectory: '.'.
24 n := 2.
25 Transcript showCr:
26 (NLS ? '''Your command, please?'', asked the waiter.').
27 Transcript showCr:
28 ((NLS at: 'a piece of cake' plural: '%1 pieces of cake' with: n) bindWith: n).
29 Transcript showCr:
30 ((NLS ? '%1 is replaced by %2.') bindWith: 'FF' with: 'EUR').!
33 Main new run!
34 EOF
36 tmpfiles="$tmpfiles prog.pot"
37 : ${XGETTEXT=xgettext}
38 ${XGETTEXT} -o prog.pot --omit-header --no-location prog.st
40 tmpfiles="$tmpfiles prog.ok"
41 cat <<EOF > prog.ok
42 msgid "'Your command, please?', asked the waiter."
43 msgstr ""
45 #, smalltalk-format
46 msgid "a piece of cake"
47 msgid_plural "%1 pieces of cake"
48 msgstr[0] ""
49 msgstr[1] ""
51 #, smalltalk-format
52 msgid "%1 is replaced by %2."
53 msgstr ""
54 EOF
56 : ${DIFF=diff}
57 ${DIFF} prog.ok prog.pot || exit 1
59 tmpfiles="$tmpfiles fr.po"
60 cat <<\EOF > fr.po
61 msgid ""
62 msgstr ""
63 "Content-Type: text/plain; charset=ISO-8859-1\n"
64 "Plural-Forms: nplurals=2; plural=(n > 1);\n"
66 msgid "'Your command, please?', asked the waiter."
67 msgstr "«Votre commande, s'il vous plait», dit le garçon."
69 # Les gateaux allemands sont les meilleurs du monde.
70 #, smalltalk-format
71 msgid "a piece of cake"
72 msgid_plural "%1 pieces of cake"
73 msgstr[0] "un morceau de gateau"
74 msgstr[1] "%1 morceaux de gateau"
76 # Reverse the arguments.
77 #, smalltalk-format
78 msgid "%1 is replaced by %2."
79 msgstr "%2 remplace %1."
80 EOF
82 tmpfiles="$tmpfiles fr.po.new"
83 : ${MSGMERGE=msgmerge}
84 ${MSGMERGE} -q -o fr.po.new fr.po prog.pot
86 : ${DIFF=diff}
87 ${DIFF} fr.po fr.po.new || exit 1
89 tmpfiles="$tmpfiles fr"
90 test -d fr || mkdir fr
91 test -d fr/LC_MESSAGES || mkdir fr/LC_MESSAGES
93 : ${MSGFMT=msgfmt}
94 ${MSGFMT} -o fr/LC_MESSAGES/prog.mo fr.po
96 # Test for presence of gst version 2.0.6 or newer.
97 (gst --version) >/dev/null 2>/dev/null \
98 || { rm -fr $tmpfiles; exit 77; }
99 case `gst --version | sed -n -e 1p | sed -e 's/^[^0-9]*//'` in
100 0.* | 1.* | 2.0 | 2.0.[0-5] | 2.1 | 2.1.[0-1])
101 rm -fr $tmpfiles; exit 77;;
102 esac
104 tmpfiles="$tmpfiles prog.ok prog.oku prog.out"
105 : ${DIFF=diff}
106 cat <<\EOF > prog.ok
107 Loading package I18N
108 «Votre commande, s'il vous plait», dit le garçon.
109 2 morceaux de gateau
110 EUR remplace FF.
112 cat <<\EOF > prog.oku
113 Loading package I18N
114 «Votre commande, s'il vous plait», dit le garçon.
115 2 morceaux de gateau
116 EUR remplace FF.
119 : ${LOCALE_FR=fr_FR}
120 : ${LOCALE_FR_UTF8=fr_FR.UTF-8}
121 if test $LOCALE_FR != none; then
122 LANGUAGE= LC_ALL=$LOCALE_FR gst -Q prog.st > prog.out || exit 1
123 ${DIFF} prog.ok prog.out || exit 1
125 if test $LOCALE_FR_UTF8 != none; then
126 LANGUAGE= LC_ALL=$LOCALE_FR_UTF8 gst -Q prog.st > prog.out || exit 1
127 ${DIFF} prog.oku prog.out || exit 1
129 if test $LOCALE_FR = none && test $LOCALE_FR_UTF8 = none; then
130 rm -fr $tmpfiles; exit 77
133 rm -fr $tmpfiles
135 exit 0