ApplicationModel.st
changeset 2841 6a4dde15bfc8
parent 2831 268d46d45ebd
child 2842 908084e21ff0
--- a/ApplicationModel.st	Mon May 03 23:16:11 2010 +0200
+++ b/ApplicationModel.st	Wed May 05 15:01:59 2010 +0200
@@ -1506,22 +1506,17 @@
      key is the symbol associated with some widget or menu item.
      Return the original (english) text; needs to be translated as per language"
 
-    |helpText helpSpec resourceArgs|
+    |helpText helpSpec "resourceArgs"|
 
     helpSpec := self flyByHelpSpec.
     helpSpec notNil ifTrue:[
         helpText := helpSpec at:aKey ifAbsent:nil.
     ].
-    helpText isNil ifTrue:[
-        masterApplication notNil ifTrue:[
-            helpText := masterApplication flyByHelpTextForKey:aKey
-        ]
-    ].
 
     "/ new: allow for a collection (resource-key arg1 arg2...)
-    (helpText isCollection and:[helpText isString not]) ifTrue:[
-        resourceArgs := helpText copyFrom:2.
+    helpText isNonByteCollection ifTrue:[
         helpText := helpText first.
+"/        resourceArgs := helpText copyFrom:2.
     ].
     ^ helpText
 !
@@ -1531,13 +1526,17 @@
      key is the symbol associated with some widget or menu item.
      Return the original (english) text; needs to be translated as per language"
 
-    |helpText|
-
-    helpText := (self helpSpec) at:aKey ifAbsent:nil.
-    helpText isNil ifTrue:[
-        masterApplication notNil ifTrue:[
-            helpText := masterApplication helpTextForKey:aKey
-        ].
+    |helpText helpSpec "resourceArgs"|
+
+    helpSpec := self helpSpec.
+    helpSpec notNil ifTrue:[
+        helpText := helpSpec at:aKey ifAbsent:nil.
+    ].
+
+    "/ new: allow for a collection (resource-key arg1 arg2...)
+    helpText isNonByteCollection ifTrue:[
+        helpText := helpText first.
+"/        resourceArgs := helpText copyFrom:2.
     ].
     ^ helpText
 !
@@ -1575,12 +1574,19 @@
 
     helpText := self basicFlyByHelpTextForKey:aKey.
     helpText isNil ifTrue:[
-        "there is no help text - resolve key from resources"
-        ^ (self translateString:aKey) withCRs.
+        masterApplication notNil ifTrue:[
+            "here we get an already translated helpText"
+            helpText := masterApplication flyByHelpTextForKey:aKey.
+        ].
+        helpText isNil ifTrue:[
+            "there is no help text - resolve key from resources"
+            helpText := (self translateString:aKey) withCRs.
+        ].
+        ^ helpText.
     ].
     "/ kludge to allow for dynamic translation by the application itself.
     helpText isBlock ifTrue:[
-        ^ helpText value
+        ^ helpText value.
     ].
 
     "get the translation"
@@ -1634,10 +1640,20 @@
      key is the symbol associated with some widget or menu item.
      (from my helpSpec); return a language variant (if available)"
 
-    |helpText|
+    |helpText translatedHelpText translatedKey|
 
     helpText := self basicHelpTextForKey:aKey.
     helpText isNil ifTrue:[
+        masterApplication notNil ifTrue:[
+            "here we get an already translated helpText"
+            helpText := masterApplication helpTextForKey:aKey.
+        ].
+        helpText isNil ifTrue:[
+            "there is no help text - resolve key from resources"
+            helpText := (self translateString:aKey) withCRs.
+        ].
+        ^ helpText.
+
 "/        aKey isSymbol ifFalse:[
 "/            ^ nil
 "/        ].
@@ -1649,8 +1665,21 @@
 "/        ^ self resources string:'Sorry, no help for: %1' with:aKey "/ nil
     ].
 
-    "/ translate.
-    ^ self translateString:helpText.
+    "/ kludge to allow for dynamic translation by the application itself.
+    helpText isBlock ifTrue:[
+        ^ helpText value.
+    ].
+
+    "get the translation"
+    translatedHelpText := self translateString:helpText.
+    translatedHelpText == helpText ifTrue:[
+        "there is no translation in the resources - maybe there is one for the key?"
+        translatedKey := self translateString:aKey.
+        translatedKey ~~ aKey ifTrue:[
+             translatedHelpText := translatedKey.
+        ].
+    ].
+    ^ translatedHelpText withCRs.
 
     "Modified: / 4.2.2000 / 15:30:16 / cg"
 ! !
@@ -3655,11 +3684,11 @@
 !ApplicationModel class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/ApplicationModel.st,v 1.301 2010-04-09 10:53:48 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/ApplicationModel.st,v 1.302 2010-05-05 13:01:59 stefan Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libview2/ApplicationModel.st,v 1.301 2010-04-09 10:53:48 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/ApplicationModel.st,v 1.302 2010-05-05 13:01:59 stefan Exp $'
 ! !
 
 ApplicationModel initialize!