Tools__InternationalLanguageTranslationEditor.st
changeset 3248 e92c9691ef33
parent 3246 034fe0de47bd
child 3264 93f5deb3f9b6
equal deleted inserted replaced
3247:ef343ef8ebad 3248:e92c9691ef33
  2149     |newTranslations|
  2149     |newTranslations|
  2150 
  2150 
  2151     newTranslations := Set new.
  2151     newTranslations := Set new.
  2152 
  2152 
  2153     self withWaitCursorDo:[
  2153     self withWaitCursorDo:[
  2154 	"/ now, the hard part:
  2154         "/ now, the hard part:
  2155 	"/ possible translations are in the specs,
  2155         "/ possible translations are in the specs,
  2156 	"/ and all arguments to (resources string:) messages.
  2156         "/ and all arguments to (resources string:) messages.
  2157 	aClass instAndClassMethodsDo:[:eachMethod |
  2157         aClass instAndClassMethodsDo:[:eachMethod |
  2158 	    newTranslations addAll:( self extractTranslationsFromMethod:eachMethod ).
  2158             newTranslations addAll:( self extractTranslationsFromMethod:eachMethod ).
  2159 	].
  2159         ].
       
  2160     ].
       
  2161     newTranslations := newTranslations select:[:eachTranslation|
       
  2162         (aClass resources at:eachTranslation ifAbsent:nil) isNil
  2160     ].
  2163     ].
  2161     ^ newTranslations
  2164     ^ newTranslations
  2162 !
  2165 !
  2163 
  2166 
  2164 extractTranslationsFromHelpSpecMethod:aMethod
  2167 extractTranslationsFromHelpSpecMethod:aMethod
  2223 
  2226 
  2224     menu := aMethod mclass theNonMetaclass perform:aMethod selector.
  2227     menu := aMethod mclass theNonMetaclass perform:aMethod selector.
  2225     menu isNil ifTrue:[ ^ #() ].
  2228     menu isNil ifTrue:[ ^ #() ].
  2226 
  2229 
  2227     (menu isKindOf:Menu) ifFalse:[
  2230     (menu isKindOf:Menu) ifFalse:[
  2228 	menu := Menu new fromLiteralArrayEncoding:menu
  2231         menu := Menu new fromLiteralArrayEncoding:menu
  2229     ].
  2232     ].
  2230 
  2233 
  2231     resourceKeys := Set new.
  2234     resourceKeys := Set new.
  2232     menu allItemsDo:[:aMenuItem |
  2235     menu allItemsDo:[:aMenuItem |
  2233 	aMenuItem translateLabel ifTrue:[
  2236         aMenuItem translateLabel ifTrue:[
  2234 	    aMenuItem isSeparatorItem ifFalse:[
  2237             (aMenuItem isSeparatorItem or:[aMenuItem isMenuSlice])  ifFalse:[
  2235 		resourceKeys add:aMenuItem label.
  2238                 resourceKeys add:aMenuItem label.
  2236 	    ]
  2239             ]
  2237 	]
  2240         ]
  2238     ].
  2241     ].
  2239     ^ resourceKeys
  2242     ^ resourceKeys
  2240 !
  2243 !
  2241 
  2244 
  2242 extractTranslationsFromMethod:aMethod
  2245 extractTranslationsFromMethod:aMethod