ApplicationModel.st
changeset 2609 a78a9e0380b1
parent 2605 20daca97e6c0
child 2615 2649ce8f0ea4
--- a/ApplicationModel.st	Fri Mar 06 12:25:03 2009 +0100
+++ b/ApplicationModel.st	Fri Mar 06 16:07:40 2009 +0100
@@ -698,8 +698,8 @@
 !
 
 resources
-    "return the applications resources - thats a ResourcePack containing
-     language strings"
+    "return the applications resources - 
+     that's a ResourcePack containing national language strings"
 
     ^ self classResources
 
@@ -1041,14 +1041,17 @@
 !
 
 resources
-    "return the applications resources - thats a ResourcePack containing
-     national language strings"
+    "return the applications resources - 
+     that's a ResourcePack containing national language strings"
 
     resources isNil ifTrue:[
         masterApplication notNil ifTrue:[
             ^ masterApplication resources
         ]
     ].
+    resources isNil ifTrue:[
+        ^ ResourcePack new
+    ].
     ^ resources
 !
 
@@ -2363,12 +2366,21 @@
     "like Objects warn, but translates the string via the
      resourcePack, thus giving a translated string automatically"
 
-    super warn:(self translateString:aString) withCRs
+    self warn:aString translate:true
 
     "Created: / 20.5.1998 / 01:14:52 / cg"
     "Modified: / 13.11.2001 / 20:10:12 / cg"
 !
 
+warn:aString translate:aBoolean
+    "like Objects warn, but optionally translates the string via the
+     resourcePack, thus giving a translated string automatically"
+
+    super warn:(aBoolean 
+                    ifTrue:[ (self translateString:aString) withCRs ]
+                    ifFalse:[ aString ]).
+!
+
 warn:aString with:arg
     "like Objects warn, but translates the string via the
      resourcePack, thus giving a translated string automatically"
@@ -2401,7 +2413,8 @@
 
 warn:aString withArguments:argArray
     "like Objects warn, but translates the string via the
-     resourcePack, thus giving a translated string automatically"
+     resourcePack, thus giving a translated string automatically.
+     Also translates \'s to newLine."
 
     |translatedString stream|
 
@@ -2409,7 +2422,7 @@
     stream := TextStream on:(translatedString species new:translatedString size + (argArray size * 10)).
     translatedString withCRs expandPlaceholdersWith:argArray on:stream.
 
-    super warn:stream contents
+    self warn:(stream contents) translate:false.
 !
 
 withCursor:aCursor do:aBlock
@@ -3345,14 +3358,7 @@
      We use the resorces as default.
      Subclasses may redefine this to use another mechanism"
 
-    |res|
-
-    res := self resources.
-    res isNil ifTrue:[
-        ^ aString
-    ].
-
-    ^ res string:aString
+    ^ self resources string:aString
 ! !
 
 !ApplicationModel methodsFor:'window events'!
@@ -3522,7 +3528,7 @@
 !ApplicationModel class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/ApplicationModel.st,v 1.281 2009-02-25 14:20:54 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/ApplicationModel.st,v 1.282 2009-03-06 15:07:40 cg Exp $'
 ! !
 
 ApplicationModel initialize!