#FEATURE by cg
authorClaus Gittinger <cg@exept.de>
Thu, 28 Apr 2016 20:16:55 +0200
changeset 3283 74fcc1bf0fab
parent 3282 4e75a66b42af
child 3284 4de194c0ee74
#FEATURE by cg class: Tools::InternationalLanguageTranslationEditor comment/format in: #extractTranslationsFromMethod: changed: #extractTranslationsFromHelpSpecMethod: also extract from helpPairs-methods, which return a literal array
Tools__InternationalLanguageTranslationEditor.st
--- a/Tools__InternationalLanguageTranslationEditor.st	Thu Apr 21 19:34:54 2016 +0200
+++ b/Tools__InternationalLanguageTranslationEditor.st	Thu Apr 28 20:16:55 2016 +0200
@@ -2177,6 +2177,7 @@
     codeStrings  :=
         #(
                 '`@dict addPairsFrom: `#helpKeysAndStrings'
+                '^ `#lit'
         ).
 
     resourceKeys := Set new.
@@ -2187,32 +2188,41 @@
         do: [:aNode :answer |
                 |sel argNode arg|
 
-                sel := aNode selector.
-                (sel startsWith:'addPairsFrom:') ifTrue:[
-                    argNode := aNode arguments at:1.
-                    argNode isLiteral ifTrue:[
-                        arg := argNode value.
-                        arg isArray ifTrue:[
-                            arg doWithIndex:[:el :index |
-                                index even ifTrue:[
-                                    el isString ifTrue:[
-                                        resourceKeys add:el.
-                                    ]
+                aNode isReturn ifTrue:[
+                    "/ a ^ #(...)
+                    aNode value isLiteralArray ifTrue:[
+                        aNode value value pairWiseDo:[:helpKey :helpString |
+                            resourceKeys add:helpString.
+                        ].
+                    ].    
+                ] ifFalse:[    
+                    sel := aNode selector.
+                    (sel startsWith:'addPairsFrom:') ifTrue:[
+                        argNode := aNode arguments at:1.
+                        argNode isLiteral ifTrue:[
+                            arg := argNode value.
+                            arg isArray ifTrue:[
+                                arg doWithIndex:[:el :index |
+                                    index even ifTrue:[
+                                        el isString ifTrue:[
+                                            resourceKeys add:el.
+                                        ]
+                                    ].
                                 ].
+                            ] ifFalse:[
+                                Transcript
+                                    showCR:(resources
+                                            string:'Cannot derive resourceKey from non-array in %1 in %2'
+                                            with:argNode formattedCode
+                                            with:aMethod selector).
                             ].
                         ] ifFalse:[
-                            Transcript
+                            Transcript halt
                                 showCR:(resources
-                                        string:'Cannot derive resourceKey from non-array in %1 in %2'
-                                        with:argNode formattedCode
-                                        with:aMethod selector).
+                                            string:'Cannot derive resourceKey from non-literal: %1 in %2'
+                                            with:argNode formattedCode
+                                            with:aMethod selector).
                         ].
-                    ] ifFalse:[
-                        Transcript halt
-                            showCR:(resources
-                                        string:'Cannot derive resourceKey from non-literal: %1 in %2'
-                                        with:argNode formattedCode
-                                        with:aMethod selector).
                     ].
                 ].
                 aNode
@@ -2248,20 +2258,20 @@
 
     mResources := aMethod resources.
     mResources notNil ifTrue:[
-	(mResources includesKey:#menu) ifTrue:[
-	     ^ self extractTranslationsFromMenuSpecMethod:aMethod.
-	].
-	(mResources includesKey:#canvas) ifTrue:[
-	     ^ self extractTranslationsFromUISpecMethod:aMethod.
-	].
-	(mResources includesKey:#help) ifTrue:[
-	     ^ self extractTranslationsFromHelpSpecMethod:aMethod.
-	].
-	(mResources includesKey:#tableColumns) ifTrue:[
-	     ^ self extractTranslationsFromTableColumnsSpecMethod:aMethod.
-	].
-
-	^ self extractTranslationsFromSpecMethod:aMethod.
+        (mResources includesKey:#menu) ifTrue:[
+             ^ self extractTranslationsFromMenuSpecMethod:aMethod.
+        ].
+        (mResources includesKey:#canvas) ifTrue:[
+             ^ self extractTranslationsFromUISpecMethod:aMethod.
+        ].
+        (mResources includesKey:#help) ifTrue:[
+             ^ self extractTranslationsFromHelpSpecMethod:aMethod.
+        ].
+        (mResources includesKey:#tableColumns) ifTrue:[
+             ^ self extractTranslationsFromTableColumnsSpecMethod:aMethod.
+        ].
+
+        ^ self extractTranslationsFromSpecMethod:aMethod.
     ].
     ^ self extractTranslationsFromMethodsCode:aMethod
 !