Tools__InternationalLanguageTranslationEditor.st
changeset 2047 5f9b26862c57
parent 2035 ea8ec7c3fbeb
child 2048 dcec4e818069
equal deleted inserted replaced
2046:67bafd381aa6 2047:5f9b26862c57
   430         nil
   430         nil
   431         nil
   431         nil
   432       )
   432       )
   433 ! !
   433 ! !
   434 
   434 
       
   435 !InternationalLanguageTranslationEditor class methodsFor:'tableColumns specs'!
       
   436 
       
   437 keyTableColumn
       
   438     "This resource specification was automatically generated
       
   439      by the DataSetBuilder of ST/X."
       
   440 
       
   441     "Do not manually edit this!! If it is corrupted,
       
   442      the DataSetBuilder may not be able to read the specification."
       
   443 
       
   444     "
       
   445      DataSetBuilder new openOnClass:Tools::InternationalLanguageTranslationEditor andSelector:#keyTableColumn
       
   446     "
       
   447 
       
   448     <resource: #tableColumns>
       
   449 
       
   450     ^#(
       
   451       (DataSetColumnSpec
       
   452          label: 'Key'
       
   453          labelButtonType: Button
       
   454          minWidth: 50
       
   455          model: keyStringInRow:
       
   456        )
       
   457       )
       
   458 !
       
   459 
       
   460 languageTableColumn
       
   461     "This resource specification was automatically generated
       
   462      by the DataSetBuilder of ST/X."
       
   463 
       
   464     "Do not manually edit this!! If it is corrupted,
       
   465      the DataSetBuilder may not be able to read the specification."
       
   466 
       
   467     "
       
   468      DataSetBuilder new openOnClass:Tools::InternationalLanguageTranslationEditor andSelector:#keyTableColumn
       
   469     "
       
   470 
       
   471     <resource: #tableColumns>
       
   472 
       
   473     ^#(
       
   474               #(DataSetColumnSpec
       
   475                  label: #lang
       
   476                  labelAlignment: center
       
   477                  labelButtonType: Button
       
   478                  minWidth: 50
       
   479                  model: #columnInRow:at:
       
   480                  canSelect: true
       
   481                  isResizeable: true
       
   482                  showRowSeparator: true
       
   483                  showColSeparator: true
       
   484                  backgroundSelector: #getBackgroundForRow:rowNr:col:
       
   485                )
       
   486 
       
   487       )
       
   488 ! !
       
   489 
   435 !InternationalLanguageTranslationEditor methodsFor:'aspects'!
   490 !InternationalLanguageTranslationEditor methodsFor:'aspects'!
   436 
   491 
   437 keyStringAndLanguageSelectionTable
   492 keyStringAndLanguageSelectionTable
   438     keyStringsToLanguageMappings isNil ifTrue:[
   493     keyStringsToLanguageMappings isNil ifTrue:[
   439         keyStringsToLanguageMappings := KeyStringsToLanguageMappings new.
   494         keyStringsToLanguageMappings := KeyStringsToLanguageMappings new.
   788         ].
   843         ].
   789     ].
   844     ].
   790 !
   845 !
   791 
   846 
   792 runApplicationAndCollectTranslations
   847 runApplicationAndCollectTranslations
   793     |applicationClass newTranslations pseudoPack app|
   848     |applicationClass newTranslations pseudoPack app startSelector|
   794 
   849 
   795     monitoredApplication notNil ifTrue:[
   850     monitoredApplication notNil ifTrue:[
   796         monitoredApplication terminate.
   851         monitoredApplication terminate.
   797         [monitoredApplication notNil] whileTrue:[
   852         [monitoredApplication notNil] whileTrue:[
   798             Delay waitForSeconds:0.1
   853             Delay waitForSeconds:0.1
   802     applicationClass := Dialog 
   857     applicationClass := Dialog 
   803                 requestClass:'Application class to start and collect translations from:'
   858                 requestClass:'Application class to start and collect translations from:'
   804                 okLabel:'OK' 
   859                 okLabel:'OK' 
   805                 initialAnswer:(lastExtractedApplicationClass ? LastExtractedApplicationClass ).
   860                 initialAnswer:(lastExtractedApplicationClass ? LastExtractedApplicationClass ).
   806     applicationClass isNil ifTrue:[^ self ].
   861     applicationClass isNil ifTrue:[^ self ].
       
   862     applicationClass isNamespace ifTrue:[
       
   863         Dialog warn:'Entered class is a NameSpace'.
       
   864         ^ self.
       
   865     ].
       
   866 
       
   867     applicationClass isVisualStartable ifTrue:[
       
   868         startSelector := #open
       
   869     ] ifFalse:[
       
   870         startSelector := Dialog
       
   871                     request:'Entered class seems to be no application class. Ok to start using selector:'
       
   872                     initialAnswer:((applicationClass respondsTo:#'start')
       
   873                                         ifTrue:#'start'
       
   874                                         ifFalse:#'new')
       
   875                     okLabel:'START'
       
   876                     title:'Start Application'.
       
   877         startSelector isNil ifTrue:[
       
   878             ^ self
       
   879         ].
       
   880         startSelector := startSelector asSymbol.
       
   881     ].
   807 
   882 
   808     lastExtractedApplicationClass := LastExtractedApplicationClass := applicationClass.
   883     lastExtractedApplicationClass := LastExtractedApplicationClass := applicationClass.
   809 
   884 
   810     newTranslations := Set new.
   885     newTranslations := Set new.
   811 
   886 
   815     self stopApplicationIconVisibleHolder value:true.
   890     self stopApplicationIconVisibleHolder value:true.
   816 
   891 
   817     monitoredApplication := [
   892     monitoredApplication := [
   818         [
   893         [
   819             app := applicationClass new.
   894             app := applicationClass new.
   820             app open.
   895             app perform:startSelector.
   821             app window waitUntilVisible.
   896             app window waitUntilVisible.
   822             app window waitUntilClosed.
   897             app window waitUntilClosed.
   823         ] ensure:[
   898         ] ensure:[
   824             app closeRequest.
   899             app closeRequest.
   825             self stopApplicationIconVisibleHolder value:false.
   900             self stopApplicationIconVisibleHolder value:false.
  1146 keyStringAndLanguageSelectionTableColumnDescription
  1221 keyStringAndLanguageSelectionTableColumnDescription
  1147     |spec|
  1222     |spec|
  1148 
  1223 
  1149     spec := OrderedCollection new.
  1224     spec := OrderedCollection new.
  1150 
  1225 
  1151     spec add:
  1226     spec add:(self class keyTableColumn first).
  1152       #(DataSetColumnSpec
       
  1153          label: 'Key'
       
  1154          labelAlignment: center
       
  1155          labelButtonType: Button
       
  1156          minWidth: 50
       
  1157          model: keyStringInRow:
       
  1158          isResizeable: true
       
  1159          canSelect: true
       
  1160          showRowSeparator: true
       
  1161          showColSeparator: true
       
  1162        ).
       
  1163 
  1227 
  1164     self shownLanguages do:[:lang |
  1228     self shownLanguages do:[:lang |
  1165         |entry|
  1229         |entry|
  1166 
  1230 
  1167         entry :=
  1231         entry := self class languageTableColumn first.
  1168               #(DataSetColumnSpec
  1232         entry := entry copy replaceAll:#lang with:lang.
  1169                  label: lang
       
  1170                  labelAlignment: center
       
  1171                  labelButtonType: Button
       
  1172                  minWidth: 50
       
  1173                  model: #columnInRow:at:
       
  1174                  canSelect: true
       
  1175                  isResizeable: true
       
  1176                  showRowSeparator: true
       
  1177                  showColSeparator: true
       
  1178                  backgroundSelector: #getBackgroundForRow:rowNr:col:
       
  1179                ).
       
  1180         entry := entry copy.
       
  1181         entry replaceAll:#lang with:lang.
       
  1182         spec add: entry 
  1233         spec add: entry 
  1183     ].
  1234     ].
  1184     ^ spec
  1235     ^ spec
  1185 !
  1236 !
  1186 
  1237