5996
|
1 |
"{ Package: 'stx:libview' }"
|
|
2 |
|
|
3 |
Object subclass:#UserMessage
|
|
4 |
instanceVariableNames:'defaultString key catalogID'
|
|
5 |
classVariableNames:''
|
|
6 |
poolDictionaries:''
|
|
7 |
category:'Interface-Internationalization'
|
|
8 |
!
|
|
9 |
|
|
10 |
|
|
11 |
!UserMessage class methodsFor:'instance creation'!
|
|
12 |
|
|
13 |
key:aKeySymbol catalogID:aCatalogSymbol
|
|
14 |
^ self new key:aKeySymbol catalogID:aCatalogSymbol
|
|
15 |
!
|
|
16 |
|
|
17 |
key:aKeySymbol defaultString:aString
|
|
18 |
^ self new key:aKeySymbol defaultString:aString
|
|
19 |
! !
|
|
20 |
|
|
21 |
!UserMessage methodsFor:'accessing'!
|
|
22 |
|
|
23 |
catalogID
|
|
24 |
^ catalogID
|
|
25 |
!
|
|
26 |
|
|
27 |
catalogID:aCatalogSymbol
|
|
28 |
catalogID := aCatalogSymbol
|
|
29 |
!
|
|
30 |
|
|
31 |
defaultString
|
|
32 |
^ defaultString
|
|
33 |
!
|
|
34 |
|
|
35 |
defaultString:aString
|
|
36 |
defaultString := aString
|
|
37 |
!
|
|
38 |
|
|
39 |
key
|
|
40 |
^ key
|
|
41 |
!
|
|
42 |
|
|
43 |
key:aKeySymbol
|
|
44 |
key := aKeySymbol.
|
|
45 |
!
|
|
46 |
|
|
47 |
key:aKeySymbol catalogID:aCatalogSymbol
|
|
48 |
key := aKeySymbol.
|
|
49 |
catalogID := aCatalogSymbol
|
|
50 |
!
|
|
51 |
|
|
52 |
key:aKeySymbol defaultString:aString
|
|
53 |
key := aKeySymbol.
|
|
54 |
defaultString := aString
|
|
55 |
! !
|
|
56 |
|
|
57 |
!UserMessage methodsFor:'converting'!
|
|
58 |
|
|
59 |
asString
|
|
60 |
"for now: return the defaultString, ignoring the catalogID."
|
|
61 |
|
|
62 |
|str|
|
|
63 |
|
|
64 |
str := self lookupInMessageCatalog.
|
|
65 |
str notNil ifTrue:[ ^ str ].
|
|
66 |
defaultString notNil ifTrue:[
|
|
67 |
^ defaultString
|
|
68 |
].
|
|
69 |
^ key asString
|
|
70 |
! !
|
|
71 |
|
|
72 |
!UserMessage methodsFor:'utilities'!
|
|
73 |
|
|
74 |
<< aSymbol
|
|
75 |
"set the catalogID"
|
|
76 |
|
|
77 |
self catalogID:aSymbol
|
|
78 |
!
|
|
79 |
|
|
80 |
>> aString
|
|
81 |
"set the default string"
|
|
82 |
|
|
83 |
self defaultString:aString
|
|
84 |
|
|
85 |
"
|
|
86 |
(#theFooMessage << #myMessages >> 'cannot read subclass of metaclass')
|
|
87 |
"
|
|
88 |
!
|
|
89 |
|
|
90 |
lookupInMessageCatalog
|
|
91 |
|class str|
|
|
92 |
|
|
93 |
"/ for now - only handle the case that the catalogID is
|
|
94 |
"/ a classes name; in that case, ask its resourcePack.
|
|
95 |
|
|
96 |
class := Smalltalk at:catalogID.
|
|
97 |
class notNil ifTrue:[
|
|
98 |
^ class classResources string:key default:defaultString
|
|
99 |
].
|
|
100 |
^ nil
|
|
101 |
|
|
102 |
"
|
|
103 |
(#'WARN_RENAME' << #BrowserView >> 'A class named %1 already exists (in ''%2'')\\that class will no longer be visible (i.e. removed) if you continue.\\Continue ?' )
|
|
104 |
(#'WARN_RENAME' << #BrowserView )
|
|
105 |
"
|
|
106 |
! !
|
|
107 |
|
|
108 |
!UserMessage class methodsFor:'documentation'!
|
|
109 |
|
|
110 |
version
|
|
111 |
^ '$Header: /cvs/stx/stx/libbasic/UserMessage.st,v 1.1 2001-09-07 15:58:03 cg Exp $'
|
|
112 |
! !
|