2175 parseTree isNil ifTrue:[^ #() ]. |
2175 parseTree isNil ifTrue:[^ #() ]. |
2176 |
2176 |
2177 codeStrings := |
2177 codeStrings := |
2178 #( |
2178 #( |
2179 '`@dict addPairsFrom: `#helpKeysAndStrings' |
2179 '`@dict addPairsFrom: `#helpKeysAndStrings' |
|
2180 '^ `#lit' |
2180 ). |
2181 ). |
2181 |
2182 |
2182 resourceKeys := Set new. |
2183 resourceKeys := Set new. |
2183 |
2184 |
2184 matcher := ParseTreeSearcher new. |
2185 matcher := ParseTreeSearcher new. |
2185 matcher |
2186 matcher |
2186 matchesAnyOf: codeStrings |
2187 matchesAnyOf: codeStrings |
2187 do: [:aNode :answer | |
2188 do: [:aNode :answer | |
2188 |sel argNode arg| |
2189 |sel argNode arg| |
2189 |
2190 |
2190 sel := aNode selector. |
2191 aNode isReturn ifTrue:[ |
2191 (sel startsWith:'addPairsFrom:') ifTrue:[ |
2192 "/ a ^ #(...) |
2192 argNode := aNode arguments at:1. |
2193 aNode value isLiteralArray ifTrue:[ |
2193 argNode isLiteral ifTrue:[ |
2194 aNode value value pairWiseDo:[:helpKey :helpString | |
2194 arg := argNode value. |
2195 resourceKeys add:helpString. |
2195 arg isArray ifTrue:[ |
2196 ]. |
2196 arg doWithIndex:[:el :index | |
2197 ]. |
2197 index even ifTrue:[ |
2198 ] ifFalse:[ |
2198 el isString ifTrue:[ |
2199 sel := aNode selector. |
2199 resourceKeys add:el. |
2200 (sel startsWith:'addPairsFrom:') ifTrue:[ |
2200 ] |
2201 argNode := aNode arguments at:1. |
|
2202 argNode isLiteral ifTrue:[ |
|
2203 arg := argNode value. |
|
2204 arg isArray ifTrue:[ |
|
2205 arg doWithIndex:[:el :index | |
|
2206 index even ifTrue:[ |
|
2207 el isString ifTrue:[ |
|
2208 resourceKeys add:el. |
|
2209 ] |
|
2210 ]. |
2201 ]. |
2211 ]. |
|
2212 ] ifFalse:[ |
|
2213 Transcript |
|
2214 showCR:(resources |
|
2215 string:'Cannot derive resourceKey from non-array in %1 in %2' |
|
2216 with:argNode formattedCode |
|
2217 with:aMethod selector). |
2202 ]. |
2218 ]. |
2203 ] ifFalse:[ |
2219 ] ifFalse:[ |
2204 Transcript |
2220 Transcript halt |
2205 showCR:(resources |
2221 showCR:(resources |
2206 string:'Cannot derive resourceKey from non-array in %1 in %2' |
2222 string:'Cannot derive resourceKey from non-literal: %1 in %2' |
2207 with:argNode formattedCode |
2223 with:argNode formattedCode |
2208 with:aMethod selector). |
2224 with:aMethod selector). |
2209 ]. |
2225 ]. |
2210 ] ifFalse:[ |
|
2211 Transcript halt |
|
2212 showCR:(resources |
|
2213 string:'Cannot derive resourceKey from non-literal: %1 in %2' |
|
2214 with:argNode formattedCode |
|
2215 with:aMethod selector). |
|
2216 ]. |
2226 ]. |
2217 ]. |
2227 ]. |
2218 aNode |
2228 aNode |
2219 ]. |
2229 ]. |
2220 |
2230 |
2246 extractTranslationsFromMethod:aMethod |
2256 extractTranslationsFromMethod:aMethod |
2247 |mResources| |
2257 |mResources| |
2248 |
2258 |
2249 mResources := aMethod resources. |
2259 mResources := aMethod resources. |
2250 mResources notNil ifTrue:[ |
2260 mResources notNil ifTrue:[ |
2251 (mResources includesKey:#menu) ifTrue:[ |
2261 (mResources includesKey:#menu) ifTrue:[ |
2252 ^ self extractTranslationsFromMenuSpecMethod:aMethod. |
2262 ^ self extractTranslationsFromMenuSpecMethod:aMethod. |
2253 ]. |
2263 ]. |
2254 (mResources includesKey:#canvas) ifTrue:[ |
2264 (mResources includesKey:#canvas) ifTrue:[ |
2255 ^ self extractTranslationsFromUISpecMethod:aMethod. |
2265 ^ self extractTranslationsFromUISpecMethod:aMethod. |
2256 ]. |
2266 ]. |
2257 (mResources includesKey:#help) ifTrue:[ |
2267 (mResources includesKey:#help) ifTrue:[ |
2258 ^ self extractTranslationsFromHelpSpecMethod:aMethod. |
2268 ^ self extractTranslationsFromHelpSpecMethod:aMethod. |
2259 ]. |
2269 ]. |
2260 (mResources includesKey:#tableColumns) ifTrue:[ |
2270 (mResources includesKey:#tableColumns) ifTrue:[ |
2261 ^ self extractTranslationsFromTableColumnsSpecMethod:aMethod. |
2271 ^ self extractTranslationsFromTableColumnsSpecMethod:aMethod. |
2262 ]. |
2272 ]. |
2263 |
2273 |
2264 ^ self extractTranslationsFromSpecMethod:aMethod. |
2274 ^ self extractTranslationsFromSpecMethod:aMethod. |
2265 ]. |
2275 ]. |
2266 ^ self extractTranslationsFromMethodsCode:aMethod |
2276 ^ self extractTranslationsFromMethodsCode:aMethod |
2267 ! |
2277 ! |
2268 |
2278 |
2269 extractTranslationsFromMethodsCode:aMethod |
2279 extractTranslationsFromMethodsCode:aMethod |