1 " Example for use of GNU gettext.
2 Copyright (C) 2003 Free Software Foundation, Inc.
3 This file is in the public domain.
5 Source code of the GNU Smalltalk program.
8 "Unfortunately the PackageLoader method fileInPackage: is extra verbose:
9 It outputs 'Loading package I18N'. This will be fixed in smalltalk-2.2.
11 PackageLoader fileInPackage: 'I18N' !
13 In the meantime, we use this workaround."
16 saved
:= Transcript message
.
17 sink
:= WriteStream with: String new
.
18 Transcript message: sink
->
#nextPutAll:.
19 PackageLoader fileInPackage: 'I18N'.
20 Transcript message: saved
.
23 Object subclass: #Main
24 instanceVariableNames: ''
25 classVariableNames: 'NLS'
29 !Main methodsFor: 'running'!
31 NLS := I18N Locale default messages
domain: 'hello-smalltalk' localeDirectory: '@localedir@'.
32 Transcript showCr: (NLS ?
'Hello, world!').
33 Transcript showCr: ((NLS ?
'This program is running as process number %1.') bindWith: self getpid
).
37 "Unfortunately I cannot define getpid like this - it gives
38 'C function getpid not defined'.
40 SystemDictionary defineCFunc: 'getpid'
41 withSelectorArgs: 'getpid'
46 So let's define it through an external process."
48 !Main methodsFor: 'auxiliary stuff'!
51 stream
:= FileDescriptor popen: 'echo $PPID' dir: #read.
52 pid
:= stream contents asNumber
.