1 " Example for use of GNU gettext.
2 This file is in the public domain.
4 Source code of the GNU Smalltalk program.
7 "Unfortunately the PackageLoader method fileInPackage: is extra verbose:
8 It outputs 'Loading package I18N'. This will be fixed in smalltalk-2.2.
10 PackageLoader fileInPackage: 'I18N' !
12 In the meantime, we use this workaround."
15 saved
:= Transcript message
.
16 sink
:= WriteStream with: String new
.
17 Transcript message: sink
->
#nextPutAll:.
18 PackageLoader fileInPackage: 'I18N'.
19 Transcript message: saved
.
22 Object subclass: #Main
23 instanceVariableNames: ''
24 classVariableNames: 'NLS'
28 !Main methodsFor: 'running'!
30 NLS := I18N Locale default messages
domain: 'hello-smalltalk' localeDirectory: '@localedir@'.
31 Transcript showCr: (NLS ?
'Hello, world!').
32 Transcript showCr: ((NLS ?
'This program is running as process number %1.') bindWith: self getpid
).
36 "Unfortunately I cannot define getpid like this - it gives
37 'C function getpid not defined'.
39 SystemDictionary defineCFunc: 'getpid'
40 withSelectorArgs: 'getpid'
45 So let's define it through an external process."
47 !Main methodsFor: 'auxiliary stuff'!
50 stream
:= FileDescriptor popen: 'echo $PPID' dir: #read.
51 pid
:= stream contents asNumber
.