~ubuntu-branches/ubuntu/breezy/gettext/breezy

« back to all changes in this revision

Viewing changes to gettext-tools/tests/lang-smalltalk

  • Committer: Bazaar Package Importer
  • Author(s): Santiago Vila
  • Date: 2004-03-14 17:40:02 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040314174002-p1ad5ldve1hqzhye
Tags: 0.14.1-2
* Added libexpat1-dev to Build-Depends, for glade support.
* Added libc0.1-dev to Build-Depends, for GNU/kFreeBSD.
* Removed special-casing of knetbsd-gnu in debian/rules.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh
 
2
 
 
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.
 
6
 
 
7
tmpfiles=""
 
8
trap 'rm -fr $tmpfiles' 1 2 3 15
 
9
 
 
10
tmpfiles="$tmpfiles prog.st"
 
11
cat <<\EOF > prog.st
 
12
PackageLoader fileInPackage: 'I18N' !
 
13
 
 
14
Object subclass: #Main
 
15
  instanceVariableNames: ''
 
16
  classVariableNames: 'NLS' 
 
17
  poolDictionaries: ''
 
18
  category: 'Program'
 
19
!
 
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').!
 
31
!
 
32
 
 
33
Main new run!
 
34
EOF
 
35
 
 
36
tmpfiles="$tmpfiles prog.pot"
 
37
: ${XGETTEXT=xgettext}
 
38
${XGETTEXT} -o prog.pot --omit-header --no-location prog.st
 
39
 
 
40
tmpfiles="$tmpfiles prog.ok"
 
41
cat <<EOF > prog.ok
 
42
msgid "'Your command, please?', asked the waiter."
 
43
msgstr ""
 
44
 
 
45
#, smalltalk-format
 
46
msgid "a piece of cake"
 
47
msgid_plural "%1 pieces of cake"
 
48
msgstr[0] ""
 
49
msgstr[1] ""
 
50
 
 
51
#, smalltalk-format
 
52
msgid "%1 is replaced by %2."
 
53
msgstr ""
 
54
EOF
 
55
 
 
56
: ${DIFF=diff}
 
57
${DIFF} prog.ok prog.pot || exit 1
 
58
 
 
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"
 
65
 
 
66
msgid "'Your command, please?', asked the waiter."
 
67
msgstr "�Votre commande, s'il vous plait�, dit le gar�on."
 
68
 
 
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"
 
75
 
 
76
# Reverse the arguments.
 
77
#, smalltalk-format
 
78
msgid "%1 is replaced by %2."
 
79
msgstr "%2 remplace %1."
 
80
EOF
 
81
 
 
82
tmpfiles="$tmpfiles fr.po.new"
 
83
: ${MSGMERGE=msgmerge}
 
84
${MSGMERGE} -q -o fr.po.new fr.po prog.pot
 
85
 
 
86
: ${DIFF=diff}
 
87
${DIFF} fr.po fr.po.new || exit 1
 
88
 
 
89
tmpfiles="$tmpfiles fr"
 
90
test -d fr || mkdir fr
 
91
test -d fr/LC_MESSAGES || mkdir fr/LC_MESSAGES
 
92
 
 
93
: ${MSGFMT=msgfmt}
 
94
${MSGFMT} -o fr/LC_MESSAGES/prog.mo fr.po
 
95
 
 
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
 
103
 
 
104
tmpfiles="$tmpfiles prog.ok 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.
 
111
EOF
 
112
 
 
113
: ${LOCALE_FR=fr_FR}
 
114
LANGUAGE= LC_ALL=$LOCALE_FR gst -Q prog.st > prog.out || exit 1
 
115
${DIFF} prog.ok prog.out || exit 1
 
116
 
 
117
rm -fr $tmpfiles
 
118
 
 
119
exit 0