#FEATURE by cg
class: MenuItem
changed:
#findGuiResourcesIn:
#findGuiResourcesIn:rememberResourcesIn:
allow %(xxx) in menu labels;
expand with labelFor:-aspect from app.
--- a/MenuItem.st Fri Dec 08 19:08:35 2017 +0100
+++ b/MenuItem.st Fri Dec 22 16:37:14 2017 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
"
COPYRIGHT (c) 1998 by eXept Software AG
All Rights Reserved
@@ -874,13 +876,16 @@
!MenuItem methodsFor:'accessing-resource'!
findGuiResourcesIn:aResourceContainerOrApplication
- "setup a resource container
- "
- ^ self findGuiResourcesIn:aResourceContainerOrApplication rememberResourcesIn:nil
+ "resolve national language translations from aResourceContainerOrApplication"
+
+ self
+ findGuiResourcesIn:aResourceContainerOrApplication
+ rememberResourcesIn:nil
!
findGuiResourcesIn:aResourceContainerOrApplication rememberResourcesIn:aValueHolderOrNil
- "resolve national language translations from aResourceContainerOrApplication"
+ "resolve national language translations from aResourceContainerOrApplication.
+ In addition, expand %(xxx) by asking the application for an xxx aspect."
|retriever m itemFont|
@@ -901,6 +906,16 @@
in:aResourceContainerOrApplication
rememberResourcesIn:aValueHolderOrNil.
].
+ (label includesString:'%(') ifTrue:[
+ |fetchDict|
+
+ fetchDict := VirtualDictionary new.
+ fetchDict
+ fetchBlock:[:key |
+ (aResourceContainerOrApplication labelFor:key asSymbol) value
+ ].
+ label := label bindWithArguments:fetchDict.
+ ].
(retriever := self resourceRetriever) notNil ifTrue:[
retriever findGuiResourcesIn:aResourceContainerOrApplication.