Menu.st
changeset 4083 014bc5ef8149
parent 4036 05c32a3bb82e
child 4086 de7c2d6148e1
--- a/Menu.st	Mon Apr 16 17:31:54 2018 +0200
+++ b/Menu.st	Tue May 01 10:39:13 2018 +0200
@@ -579,17 +579,27 @@
     "resolve national language translations from aResourceContainerOrApplication.
      Unless already set, remember aResourceContainerOrApplication as menu receiver"
 
+    ^ self findGuiResourcesIn:aResourceContainerOrApplication for:nil
+
+    "Modified: / 26-10-2006 / 16:37:57 / cg"
+!
+
+findGuiResourcesIn:aResourceContainerOrApplication for:aViewOrNil
+    "resolve national language translations from aResourceContainerOrApplication.
+     Unless already set, remember aResourceContainerOrApplication as menu receiver"
+
     receiver isNil ifTrue:[
         receiver := aResourceContainerOrApplication
     ].
     self 
-        findGuiResourcesIn:aResourceContainerOrApplication 
+        findGuiResourcesIn:aResourceContainerOrApplication
+        for:aViewOrNil
         rememberResourcesIn:(ValueHolder new)
 
     "Modified: / 26-10-2006 / 16:37:57 / cg"
 !
 
-findGuiResourcesIn:aResourceContainerOrApplication rememberResourcesIn:aValueHolderOrNil
+findGuiResourcesIn:aResourceContainerOrApplication for:aViewOrNil rememberResourcesIn:aValueHolderOrNil
     "resolve national language translations from aResourceContainerOrApplication"
 
     |need resolvedItems rcv|
@@ -625,10 +635,18 @@
             rcv := aResourceContainerOrApplication.
             [rcv notNil and:[resItems isNil]] whileTrue:[
                 "/ pass down the original app while walking the master chain,
-                "/ so that subclices can be redefined (is that what we want???)
+                "/ so that subclices can be redefined by the master
+                "/ (is that what we want???)
                 resItems := anItem resolveSliceMenuItemsIn:rcv for:aResourceContainerOrApplication rememberResourcesIn:aValueHolderOrNil.
                 rcv := rcv perform:#masterApplication ifNotUnderstood:nil.
             ].
+            "/ if there is no mastApp, or it did not provide the slice,
+            "/ ask the view itself.
+            resItems isNil ifTrue:[
+                aViewOrNil notNil ifTrue:[
+                    resItems := anItem resolveSliceMenuItemsIn:aViewOrNil for:aResourceContainerOrApplication rememberResourcesIn:aValueHolderOrNil.
+                ].
+            ].
 
             resItems notEmptyOrNil ifTrue:[
                 resolvedItems addAll:resItems.
@@ -641,6 +659,15 @@
     items := resolvedItems.
 
     "Modified: / 23-07-2017 / 12:17:58 / cg"
+!
+
+findGuiResourcesIn:aResourceContainerOrApplication rememberResourcesIn:aValueHolderOrNil
+    "resolve national language translations from aResourceContainerOrApplication"
+
+    ^ self 
+        findGuiResourcesIn:aResourceContainerOrApplication 
+        for:nil
+        rememberResourcesIn:aValueHolderOrNil
 ! !
 
 !Menu methodsFor:'adding & removing'!