#FEATURE by cg
class: Tools::InternationalLanguageTranslationEditor
prepared: #searchTranslation (unfinished)
changed:
#addTranslation (send #isEmptyOrNil instead of #isEmpty)
#objectsList
#searchNextTextIncludingCurrentSelection:
class: Tools::InternationalLanguageTranslationEditor class
changed: #translationsMenuSpec
--- a/Tools__InternationalLanguageTranslationEditor.st Thu Oct 25 10:58:53 2018 +0200
+++ b/Tools__InternationalLanguageTranslationEditor.st Thu Oct 25 16:26:05 2018 +0200
@@ -952,54 +952,63 @@
<resource: #menu>
- ^
+ ^
#(Menu
- (
- (MenuItem
- label: 'Add Translation...'
- itemValue: addTranslation
- )
- (MenuItem
- label: 'Remove Translation...'
- itemValue: removeTranslation
- )
- (MenuItem
- label: '-'
- )
- (MenuItem
- label: 'Extract from Package...'
- itemValue: extractTranslationsFromProject
- )
- (MenuItem
- label: 'Extract from Class...'
- itemValue: extractTranslationsFromClass
- )
- (MenuItem
- label: 'Extract from NameSpace...'
- itemValue: extractTranslationsFromNameSpace
- )
- (MenuItem
- label: '-'
- )
- (MenuItem
- label: 'Run Application and Collect Translations...'
- itemValue: runApplicationAndCollectTranslations
- )
- (MenuItem
- label: '-'
- )
- (MenuItem
- label: 'Generate Missing Translations'
- itemValue: generateMissingTranslations
- )
- (MenuItem
- label: 'Generate Missing Translations Slice'
- submenuChannel: menuSliceTranslateGenerate
- isMenuSlice: true
- )
- )
- nil
- nil
+ (
+ (MenuItem
+ label: 'Add Translation...'
+ itemValue: addTranslation
+ )
+ (MenuItem
+ label: 'Remove Translation...'
+ itemValue: removeTranslation
+ )
+ (MenuItem
+ label: '-'
+ isVisible: false
+ )
+ (MenuItem
+ label: 'Search Translation...'
+ itemValue: searchTranslation
+ isVisible: false
+ )
+ (MenuItem
+ label: '-'
+ )
+ (MenuItem
+ label: 'Extract from Package...'
+ itemValue: extractTranslationsFromProject
+ )
+ (MenuItem
+ label: 'Extract from Class...'
+ itemValue: extractTranslationsFromClass
+ )
+ (MenuItem
+ label: 'Extract from NameSpace...'
+ itemValue: extractTranslationsFromNameSpace
+ )
+ (MenuItem
+ label: '-'
+ )
+ (MenuItem
+ label: 'Run Application and Collect Translations...'
+ itemValue: runApplicationAndCollectTranslations
+ )
+ (MenuItem
+ label: '-'
+ )
+ (MenuItem
+ label: 'Generate Missing Translations'
+ itemValue: generateMissingTranslations
+ )
+ (MenuItem
+ label: 'Generate Missing Translations Slice'
+ submenuChannel: menuSliceTranslateGenerate
+ isMenuSlice: true
+ )
+ )
+ nil
+ nil
)
! !
@@ -1108,7 +1117,9 @@
objectsList
- ^ self keyStringsToLanguageMappings
+ ^ keyStringsToLanguageMappings
+
+ "Modified: / 25-10-2018 / 16:25:08 / Claus Gittinger"
!
selectListIndex: rowIndex
@@ -1725,7 +1736,7 @@
|key index|
key := Dialog request:'New Key:'.
- key isEmpty ifTrue:[^self].
+ key isEmptyOrNil ifTrue:[^self].
(self includesKey:key) ifFalse:[
keyStringsToLanguageMappings addKey:key.
@@ -1733,6 +1744,8 @@
].
index := keyStringsToLanguageMappings indexOfKey:key.
self selectedKeyRow value:index
+
+ "Modified: / 25-10-2018 / 16:16:21 / Claus Gittinger"
!
browseReferringMethods
@@ -2231,6 +2244,39 @@
]
initialText:selectedKey "/ does not work: ('''*',selectedKey,'*''') check match!!
].
+!
+
+searchTranslation
+ |searched foundIn foundExactIn foundMatchIn|
+
+ searched := Dialog request:'Key or Value to Search:'.
+ searched isEmptyOrNil ifTrue:[^self].
+
+ foundIn := OrderedCollection new.
+ ResourcePack allInstancesDo:[:each |
+ each keysAndValuesDo:[:key :val |
+ |orig xlation|
+
+ orig := key printString.
+ xlation := val printString.
+ (orig = searched or:[xlation = searched]) ifTrue:[
+ foundExactIn add:each
+ ] ifFalse:[
+ ((orig includesString:searched caseSensitive:false)
+ or:[xlation includesString:searched caseSensitive:false]) ifTrue:[
+ foundIn add:each
+ ] ifFalse:[
+ ((searched match:orig caseSensitive:false)
+ or:[searched match:xlation caseSensitive:false]) ifTrue:[
+ foundMatchIn add:each
+ ].
+ ].
+ ].
+ ].
+ ].
+self halt.
+
+ "Created: / 25-10-2018 / 16:16:13 / Claus Gittinger"
! !
!InternationalLanguageTranslationEditor methodsFor:'menus dynamic'!
@@ -2894,32 +2940,33 @@
self searchTextStarted.
searchText := searchTextView contents.
searchText isEmptyOrNil ifTrue:[^self].
- self objectsList isEmpty ifTrue:[^self].
+ self objectsList isEmptyOrNil ifTrue:[^self].
currentSelectionIndex := self currentSelectionIndex.
(currentSelectionIndex isNil or:[currentSelectionIndex == 0]) ifTrue:[
- self searchNextTextFromBeginning.
- ^self.
+ self searchNextTextFromBeginning.
+ ^self.
].
listSize := self objectsList size.
(currentSelectionIndex == listSize and:[includeCurrentSelection not]) ifTrue:[
- self searchNextTextReachEnd.
- ^self.
+ self searchNextTextReachEnd.
+ ^self.
].
fromIndex := includeCurrentSelection
- ifTrue:[currentSelectionIndex]
- ifFalse:[currentSelectionIndex + 1].
+ ifTrue:[currentSelectionIndex]
+ ifFalse:[currentSelectionIndex + 1].
rowFoundIndex := self tableView findFirstRowWithString: searchText
- from:fromIndex
- to:listSize
- ignoreCase:self ignoreCaseHolder value.
+ from:fromIndex
+ to:listSize
+ ignoreCase:self ignoreCaseHolder value.
rowFoundIndex isNil ifTrue:[
- self searchNextTextReachEnd.
- ^self
+ self searchNextTextReachEnd.
+ ^self
].
self selectListIndex: rowFoundIndex
"Created: / 16-06-2007 / 09:20:57 / Administrador"
"Modified: / 19-06-2007 / 15:38:06 / Administrador"
+ "Modified: / 25-10-2018 / 16:25:18 / Claus Gittinger"
!
searchNextTextReachEnd