Tools__InternationalLanguageTranslationEditor.st
changeset 2034 23d558e4d32e
parent 2033 2c1264ae2c1c
child 2035 ea8ec7c3fbeb
equal deleted inserted replaced
2033:2c1264ae2c1c 2034:23d558e4d32e
   878 ! !
   878 ! !
   879 
   879 
   880 !InternationalLanguageTranslationEditor methodsFor:'private-key extraction'!
   880 !InternationalLanguageTranslationEditor methodsFor:'private-key extraction'!
   881 
   881 
   882 addAllTranslations:newTranslations
   882 addAllTranslations:newTranslations
   883     |newTranslationKeys|
   883     |newTranslationKeys stringKeys nonStringKeys|
   884 
   884 
   885     newTranslationKeys := newTranslations select:[:k | k notEmpty and:[k isBlank not]].
   885     newTranslationKeys := newTranslations select:[:k | k notEmpty and:[k isString not or:[k isBlank not]]].
   886     newTranslationKeys := newTranslationKeys select:[:k | (keyStringsToLanguageMappings includesKey:k) not].
   886     newTranslationKeys := newTranslationKeys select:[:k | (keyStringsToLanguageMappings includesKey:k) not].
       
   887     newTranslationKeys := newTranslationKeys 
       
   888                                 collect:[:k | 
       
   889                                         (k endsWith:'...') ifTrue:[
       
   890                                             k copyWithoutLast:3.
       
   891                                         ] ifFalse:[
       
   892                                             ('.:' includes:k last) ifTrue:[
       
   893                                                 k copyWithoutLast:1.
       
   894                                             ] ifFalse:[
       
   895                                                 k
       
   896                                         ]]].
       
   897     newTranslationKeys := newTranslationKeys asSet.
       
   898 
   887     newTranslationKeys notEmpty ifTrue:[
   899     newTranslationKeys notEmpty ifTrue:[
   888         newTranslationKeys := newTranslationKeys asSortedCollection.
   900         stringKeys := newTranslationKeys select:[:k | k isString].
   889         keyStringsToLanguageMappings addKeys:newTranslationKeys.
   901         nonStringKeys := newTranslationKeys select:[:k | k isString not].
       
   902 
       
   903         stringKeys := stringKeys asSortedCollection.
       
   904         keyStringsToLanguageMappings addKeys:stringKeys.
       
   905         keyStringsToLanguageMappings addKeys:nonStringKeys.
   890         modified := true.
   906         modified := true.
   891     ].
   907     ].
   892 !
   908 !
   893 
   909 
   894 extractTranslationsFromClass:aClass
   910 extractTranslationsFromClass:aClass