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 |
|
6008
|
10 |
!UserMessage class methodsFor:'documentation'!
|
|
11 |
|
|
12 |
documentation
|
|
13 |
"
|
|
14 |
added for vw5i compatibility, which accesses messageCatalogs
|
|
15 |
via:
|
|
16 |
(#key << #catalogID >> 'defaultMessage')
|
|
17 |
which creates an instance of UserMessage.
|
|
18 |
|
|
19 |
Currently, this is a dummy operation in ST/X, however it is mapped onto
|
|
20 |
the resource mechanism, if the given catalogID is the name of a class;
|
|
21 |
i.e.
|
|
22 |
(YesNoBox classResources string:'continue')
|
|
23 |
can now also be written as:
|
|
24 |
(#continue << #YesNoBox)
|
|
25 |
"
|
|
26 |
! !
|
5996
|
27 |
|
|
28 |
!UserMessage class methodsFor:'instance creation'!
|
|
29 |
|
|
30 |
key:aKeySymbol catalogID:aCatalogSymbol
|
|
31 |
^ self new key:aKeySymbol catalogID:aCatalogSymbol
|
|
32 |
!
|
|
33 |
|
|
34 |
key:aKeySymbol defaultString:aString
|
|
35 |
^ self new key:aKeySymbol defaultString:aString
|
|
36 |
! !
|
|
37 |
|
|
38 |
!UserMessage methodsFor:'accessing'!
|
|
39 |
|
|
40 |
catalogID
|
|
41 |
^ catalogID
|
|
42 |
!
|
|
43 |
|
|
44 |
catalogID:aCatalogSymbol
|
|
45 |
catalogID := aCatalogSymbol
|
|
46 |
!
|
|
47 |
|
|
48 |
defaultString
|
|
49 |
^ defaultString
|
|
50 |
!
|
|
51 |
|
|
52 |
defaultString:aString
|
|
53 |
defaultString := aString
|
|
54 |
!
|
|
55 |
|
|
56 |
key
|
|
57 |
^ key
|
|
58 |
!
|
|
59 |
|
|
60 |
key:aKeySymbol
|
|
61 |
key := aKeySymbol.
|
|
62 |
!
|
|
63 |
|
|
64 |
key:aKeySymbol catalogID:aCatalogSymbol
|
|
65 |
key := aKeySymbol.
|
|
66 |
catalogID := aCatalogSymbol
|
|
67 |
!
|
|
68 |
|
|
69 |
key:aKeySymbol defaultString:aString
|
|
70 |
key := aKeySymbol.
|
|
71 |
defaultString := aString
|
|
72 |
! !
|
|
73 |
|
|
74 |
!UserMessage methodsFor:'converting'!
|
|
75 |
|
|
76 |
asString
|
|
77 |
"for now: return the defaultString, ignoring the catalogID."
|
|
78 |
|
|
79 |
|str|
|
|
80 |
|
|
81 |
str := self lookupInMessageCatalog.
|
|
82 |
str notNil ifTrue:[ ^ str ].
|
|
83 |
defaultString notNil ifTrue:[
|
|
84 |
^ defaultString
|
|
85 |
].
|
|
86 |
^ key asString
|
|
87 |
! !
|
|
88 |
|
|
89 |
!UserMessage methodsFor:'utilities'!
|
|
90 |
|
|
91 |
<< aSymbol
|
|
92 |
"set the catalogID"
|
|
93 |
|
|
94 |
self catalogID:aSymbol
|
|
95 |
!
|
|
96 |
|
|
97 |
>> aString
|
|
98 |
"set the default string"
|
|
99 |
|
|
100 |
self defaultString:aString
|
|
101 |
|
|
102 |
"
|
|
103 |
(#theFooMessage << #myMessages >> 'cannot read subclass of metaclass')
|
|
104 |
"
|
|
105 |
!
|
|
106 |
|
|
107 |
lookupInMessageCatalog
|
|
108 |
|class str|
|
|
109 |
|
|
110 |
"/ for now - only handle the case that the catalogID is
|
|
111 |
"/ a classes name; in that case, ask its resourcePack.
|
|
112 |
|
|
113 |
class := Smalltalk at:catalogID.
|
|
114 |
class notNil ifTrue:[
|
|
115 |
^ class classResources string:key default:defaultString
|
|
116 |
].
|
|
117 |
^ nil
|
|
118 |
|
|
119 |
"
|
|
120 |
(#'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 ?' )
|
|
121 |
(#'WARN_RENAME' << #BrowserView )
|
|
122 |
"
|
|
123 |
! !
|
|
124 |
|
|
125 |
!UserMessage class methodsFor:'documentation'!
|
|
126 |
|
|
127 |
version
|
6008
|
128 |
^ '$Header: /cvs/stx/stx/libbasic/UserMessage.st,v 1.2 2001-09-07 18:45:25 cg Exp $'
|
5996
|
129 |
! !
|