Tools__InternationalLanguageTranslationEditor.st
changeset 2015 8f226ff9b5e6
child 2031 85947c4c6502
equal deleted inserted replaced
2014:a7b9b0fd9b62 2015:8f226ff9b5e6
       
     1 "{ Package: 'stx:libtool2' }"
       
     2 
       
     3 "{ NameSpace: Tools }"
       
     4 
       
     5 ApplicationModel subclass:#InternationalLanguageTranslationEditor
       
     6 	instanceVariableNames:'languagesList keyStringsToLanguageMappings languageTextHolder
       
     7 		originalTextHolder modified shownLanguages selectedKeyRow
       
     8 		showMissingTranslationsOnly
       
     9 		keyStringAndLanguageSelectionTableColumnDescriptionHolder
       
    10 		languageShownHolders dataSetView lastExtractedClass
       
    11 		lastExtractedApplicationClass stopApplicationIconVisibleHolder
       
    12 		monitoredApplication originalTextModifiedHolder
       
    13 		languageTextModifiedHolder'
       
    14 	classVariableNames:'LastExtractedClass LastExtractedApplicationClass'
       
    15 	poolDictionaries:''
       
    16 	category:'Interface-UIPainter'
       
    17 !
       
    18 
       
    19 Object subclass:#AccessCollectingPseudoResourcePack
       
    20 	instanceVariableNames:'collectedKeys realResourcePack'
       
    21 	classVariableNames:''
       
    22 	poolDictionaries:''
       
    23 	privateIn:InternationalLanguageTranslationEditor
       
    24 !
       
    25 
       
    26 Collection subclass:#KeyStringsToLanguageMappings
       
    27 	instanceVariableNames:'keys languageMappings languages'
       
    28 	classVariableNames:''
       
    29 	poolDictionaries:''
       
    30 	privateIn:InternationalLanguageTranslationEditor
       
    31 !
       
    32 
       
    33 Object subclass:#LanguageMappingRow
       
    34 	instanceVariableNames:'key mappings'
       
    35 	classVariableNames:''
       
    36 	poolDictionaries:''
       
    37 	privateIn:InternationalLanguageTranslationEditor
       
    38 !
       
    39 
       
    40 Visitor subclass:#UISpecVisitor
       
    41 	instanceVariableNames:'translatedLabels'
       
    42 	classVariableNames:''
       
    43 	poolDictionaries:''
       
    44 	privateIn:InternationalLanguageTranslationEditor
       
    45 !
       
    46 
       
    47 !InternationalLanguageTranslationEditor class methodsFor:'documentation'!
       
    48 
       
    49 documentation
       
    50 "
       
    51     documentation to be added.
       
    52 
       
    53     [author:]
       
    54         cg (cg@FUSI)
       
    55 
       
    56     [instance variables:]
       
    57 
       
    58     [class variables:]
       
    59 
       
    60     [see also:]
       
    61 
       
    62 "
       
    63 !
       
    64 
       
    65 examples
       
    66 "
       
    67   Starting the application:
       
    68                                                                 [exBegin]
       
    69     InternationalLanguageTranslationEditor open
       
    70 
       
    71                                                                 [exEnd]
       
    72 
       
    73   more examples to be added:
       
    74                                                                 [exBegin]
       
    75     ... add code fragment for 
       
    76     ... executable example here ...
       
    77                                                                 [exEnd]
       
    78 "
       
    79 !
       
    80 
       
    81 history
       
    82     "Created: / 04-03-2006 / 09:07:19 / cg"
       
    83 ! !
       
    84 
       
    85 !InternationalLanguageTranslationEditor class methodsFor:'interface specs'!
       
    86 
       
    87 windowSpec
       
    88     "This resource specification was automatically generated
       
    89      by the UIPainter of ST/X."
       
    90 
       
    91     "Do not manually edit this!! If it is corrupted,
       
    92      the UIPainter may not be able to read the specification."
       
    93 
       
    94     "
       
    95      UIPainter new openOnClass:InternationalLanguageTranslationEditor andSelector:#windowSpec
       
    96      InternationalLanguageTranslationEditor new openInterface:#windowSpec
       
    97      InternationalLanguageTranslationEditor open
       
    98     "
       
    99 
       
   100     <resource: #canvas>
       
   101 
       
   102     ^ 
       
   103      #(FullSpec
       
   104         name: windowSpec
       
   105         window: 
       
   106        (WindowSpec
       
   107           label: 'InternationalLanguageTranslationEditor'
       
   108           name: 'InternationalLanguageTranslationEditor'
       
   109           min: (Point 10 10)
       
   110           max: (Point 1024 768)
       
   111           bounds: (Rectangle 0 0 640 400)
       
   112           menu: mainMenu
       
   113         )
       
   114         component: 
       
   115        (SpecCollection
       
   116           collection: (
       
   117            (MenuPanelSpec
       
   118               name: 'ToolBar'
       
   119               layout: (LayoutFrame 0 0 0 0 0 1 30 0)
       
   120               menu: menuToolBar
       
   121               textDefault: true
       
   122             )
       
   123            (VariableVerticalPanelSpec
       
   124               name: 'VariableVerticalPanel1'
       
   125               layout: (LayoutFrame 0 0 30 0 0 1 0 1)
       
   126               component: 
       
   127              (SpecCollection
       
   128                 collection: (
       
   129                  (DataSetSpec
       
   130                     name: 'KeyStringAndLanguageSelectionTable'
       
   131                     model: selectedKeyRow
       
   132                     hasHorizontalScrollBar: true
       
   133                     hasVerticalScrollBar: true
       
   134                     dataList: keyStringAndLanguageSelectionTable
       
   135                     columnHolder: keyStringAndLanguageSelectionTableColumnDescriptionHolder
       
   136                     columnAdaptor: yourself
       
   137                     postBuildCallback: postBuildDataSet:
       
   138                   )
       
   139                  (ViewSpec
       
   140                     name: 'Box1'
       
   141                     component: 
       
   142                    (SpecCollection
       
   143                       collection: (
       
   144                        (LabelSpec
       
   145                           label: 'Original String (Key):'
       
   146                           name: 'Label2'
       
   147                           layout: (LayoutFrame 0 0 0 0 0 1 30 0)
       
   148                           translateLabel: true
       
   149                           adjust: left
       
   150                         )
       
   151                        (TextEditorSpec
       
   152                           name: 'OriginalText'
       
   153                           layout: (LayoutFrame 0 0 30 0 0 1 0 1)
       
   154                           model: originalTextHolder
       
   155                           hasHorizontalScrollBar: true
       
   156                           hasVerticalScrollBar: true
       
   157                           modifiedChannel: originalTextModifiedHolder
       
   158                         )
       
   159                        )
       
   160                      
       
   161                     )
       
   162                   )
       
   163                  (ViewSpec
       
   164                     name: 'Box2'
       
   165                     component: 
       
   166                    (SpecCollection
       
   167                       collection: (
       
   168                        (LabelSpec
       
   169                           label: 'Translated String:'
       
   170                           name: 'Label1'
       
   171                           layout: (LayoutFrame 0 0 0 0 0 1 30 0)
       
   172                           translateLabel: true
       
   173                           adjust: left
       
   174                         )
       
   175                        (TextEditorSpec
       
   176                           name: 'LanguageText'
       
   177                           layout: (LayoutFrame 0 0 30 0 0 1 0 1)
       
   178                           model: languageTextHolder
       
   179                           hasHorizontalScrollBar: true
       
   180                           hasVerticalScrollBar: true
       
   181                           modifiedChannel: languageTextModifiedHolder
       
   182                         )
       
   183                        )
       
   184                      
       
   185                     )
       
   186                   )
       
   187                  )
       
   188                
       
   189               )
       
   190               handles: (Any 0.33333333333333 0.66666666666667 1.0)
       
   191             )
       
   192            )
       
   193          
       
   194         )
       
   195       )
       
   196 ! !
       
   197 
       
   198 !InternationalLanguageTranslationEditor class methodsFor:'menu specs'!
       
   199 
       
   200 mainMenu
       
   201     "This resource specification was automatically generated
       
   202      by the MenuEditor of ST/X."
       
   203 
       
   204     "Do not manually edit this!! If it is corrupted,
       
   205      the MenuEditor may not be able to read the specification."
       
   206 
       
   207     "
       
   208      MenuEditor new openOnClass:InternationalLanguageTranslationEditor andSelector:#mainMenu
       
   209      (Menu new fromLiteralArrayEncoding:(InternationalLanguageTranslationEditor mainMenu)) startUp
       
   210     "
       
   211 
       
   212     <resource: #menu>
       
   213 
       
   214     ^ 
       
   215      #(Menu
       
   216         (
       
   217          (MenuItem
       
   218             label: 'File'
       
   219             translateLabel: true
       
   220             submenu: 
       
   221            (Menu
       
   222               (
       
   223                (MenuItem
       
   224                   label: 'New'
       
   225                   itemValue: menuNew
       
   226                   translateLabel: true
       
   227                 )
       
   228                (MenuItem
       
   229                   label: '-'
       
   230                 )
       
   231                (MenuItem
       
   232                   label: 'Open Resource File...'
       
   233                   itemValue: menuOpen
       
   234                   translateLabel: true
       
   235                 )
       
   236                (MenuItem
       
   237                   label: '-'
       
   238                 )
       
   239                (MenuItem
       
   240                   label: 'Save Resource File'
       
   241                   itemValue: menuSave
       
   242                   translateLabel: true
       
   243                 )
       
   244                (MenuItem
       
   245                   label: 'Save Resource File As...'
       
   246                   itemValue: menuSaveAs
       
   247                   translateLabel: true
       
   248                 )
       
   249                (MenuItem
       
   250                   label: '-'
       
   251                 )
       
   252                (MenuItem
       
   253                   label: 'Exit'
       
   254                   itemValue: closeRequest
       
   255                   translateLabel: true
       
   256                 )
       
   257                )
       
   258               nil
       
   259               nil
       
   260             )
       
   261           )
       
   262          (MenuItem
       
   263             label: 'View'
       
   264             translateLabel: true
       
   265             submenu: 
       
   266            (Menu
       
   267               (
       
   268                (MenuItem
       
   269                   label: 'Show Missing Translations Only'
       
   270                   translateLabel: true
       
   271                   indication: showMissingTranslationsOnly
       
   272                 )
       
   273                (MenuItem
       
   274                   label: '-'
       
   275                 )
       
   276                (MenuItem
       
   277                   label: 'Shown Languages'
       
   278                   translateLabel: true
       
   279                   submenuChannel: shownLanguagesMenu
       
   280                 )
       
   281                )
       
   282               nil
       
   283               nil
       
   284             )
       
   285           )
       
   286          (MenuItem
       
   287             label: 'Languages'
       
   288             translateLabel: true
       
   289             submenu: 
       
   290            (Menu
       
   291               (
       
   292                (MenuItem
       
   293                   label: 'Add Language...'
       
   294                   itemValue: addLanguage
       
   295                   translateLabel: true
       
   296                 )
       
   297                (MenuItem
       
   298                   label: 'Remove Language...'
       
   299                   itemValue: removeLanguage
       
   300                   translateLabel: true
       
   301                 )
       
   302                )
       
   303               nil
       
   304               nil
       
   305             )
       
   306           )
       
   307          (MenuItem
       
   308             label: 'Translations'
       
   309             translateLabel: true
       
   310             submenu: 
       
   311            (Menu
       
   312               (
       
   313                (MenuItem
       
   314                   label: 'Add Translation...'
       
   315                   itemValue: addTranslation
       
   316                   translateLabel: true
       
   317                 )
       
   318                (MenuItem
       
   319                   label: 'Remove Translation...'
       
   320                   itemValue: removeTranslation
       
   321                   translateLabel: true
       
   322                 )
       
   323                (MenuItem
       
   324                   label: '-'
       
   325                 )
       
   326                (MenuItem
       
   327                   label: 'Extract from Class...'
       
   328                   itemValue: extractTranslationsFromClass
       
   329                   translateLabel: true
       
   330                 )
       
   331                (MenuItem
       
   332                   label: 'Run Application and Collect Translations...'
       
   333                   itemValue: runApplicationAndCollectTranslations
       
   334                   translateLabel: true
       
   335                 )
       
   336                )
       
   337               nil
       
   338               nil
       
   339             )
       
   340           )
       
   341          (MenuItem
       
   342             label: 'Help'
       
   343             translateLabel: true
       
   344             startGroup: right
       
   345             submenu: 
       
   346            (Menu
       
   347               (
       
   348                (MenuItem
       
   349                   label: 'Documentation'
       
   350                   itemValue: openDocumentation
       
   351                   translateLabel: true
       
   352                 )
       
   353                (MenuItem
       
   354                   label: '-'
       
   355                 )
       
   356                (MenuItem
       
   357                   label: 'About this Application...'
       
   358                   itemValue: openAboutThisApplication
       
   359                   translateLabel: true
       
   360                 )
       
   361                )
       
   362               nil
       
   363               nil
       
   364             )
       
   365           )
       
   366          )
       
   367         nil
       
   368         nil
       
   369       )
       
   370 !
       
   371 
       
   372 menuToolBar
       
   373     "This resource specification was automatically generated
       
   374      by the MenuEditor of ST/X."
       
   375 
       
   376     "Do not manually edit this!! If it is corrupted,
       
   377      the MenuEditor may not be able to read the specification."
       
   378 
       
   379     "
       
   380      MenuEditor new openOnClass:InternationalLanguageTranslationEditor andSelector:#menuToolBar
       
   381      (Menu new fromLiteralArrayEncoding:(InternationalLanguageTranslationEditor menuToolBar)) startUp
       
   382     "
       
   383 
       
   384     <resource: #menu>
       
   385 
       
   386     ^ 
       
   387      #(Menu
       
   388         (
       
   389          (MenuItem
       
   390             label: 'Save'
       
   391             translateLabel: true
       
   392             labelImage: (ResourceRetriever XPToolbarIconLibrary saveImageIcon)
       
   393           )
       
   394          (MenuItem
       
   395             label: '-'
       
   396           )
       
   397          (MenuItem
       
   398             label: 'Add Translation'
       
   399             itemValue: addTranslation
       
   400             translateLabel: true
       
   401             labelImage: (ResourceRetriever XPToolbarIconLibrary newRowIcon)
       
   402           )
       
   403          (MenuItem
       
   404             label: 'Remove Translation'
       
   405             itemValue: removeTranslation
       
   406             translateLabel: true
       
   407             labelImage: (ResourceRetriever XPToolbarIconLibrary removeRowIcon)
       
   408           )
       
   409          (MenuItem
       
   410             label: ''
       
   411           )
       
   412          (MenuItem
       
   413             label: 'Stop Application'
       
   414             itemValue: stopApplication
       
   415             translateLabel: true
       
   416             isVisible: stopApplicationIconVisibleHolder
       
   417             labelImage: (ResourceRetriever XPToolbarIconLibrary stop16x16Icon)
       
   418           )
       
   419          )
       
   420         nil
       
   421         nil
       
   422       )
       
   423 ! !
       
   424 
       
   425 !InternationalLanguageTranslationEditor methodsFor:'aspects'!
       
   426 
       
   427 keyStringAndLanguageSelectionTable
       
   428     keyStringsToLanguageMappings isNil ifTrue:[
       
   429         keyStringsToLanguageMappings := KeyStringsToLanguageMappings new.
       
   430     ].
       
   431     ^ keyStringsToLanguageMappings.
       
   432 !
       
   433 
       
   434 keyStringAndLanguageSelectionTableColumnDescriptionHolder
       
   435     keyStringAndLanguageSelectionTableColumnDescriptionHolder isNil ifTrue:[
       
   436         keyStringAndLanguageSelectionTableColumnDescriptionHolder := ValueHolder new.
       
   437         keyStringAndLanguageSelectionTableColumnDescriptionHolder value:(self keyStringAndLanguageSelectionTableColumnDescription).
       
   438     ].
       
   439     ^ keyStringAndLanguageSelectionTableColumnDescriptionHolder.
       
   440 !
       
   441 
       
   442 languageAtCol:colNr
       
   443     ^ shownLanguages at:colNr-1.
       
   444 !
       
   445 
       
   446 languageShownHolderFor:lang
       
   447     |holder|
       
   448 
       
   449     languageShownHolders isNil ifTrue:[
       
   450         languageShownHolders := Dictionary new
       
   451     ].
       
   452     holder := languageShownHolders 
       
   453                 at:lang 
       
   454                 ifAbsentPut:[ 
       
   455                     |h|
       
   456 
       
   457                     h := true asValue.
       
   458                     h onChangeEvaluate:[ 
       
   459                         h value ifTrue:[
       
   460                            self enableLanguageDisplayFor:lang     
       
   461                         ] ifFalse:[
       
   462                            self disableLanguageDisplayFor:lang     
       
   463                         ].
       
   464                     ].
       
   465                     h
       
   466                 ].
       
   467     ^ holder.
       
   468 !
       
   469 
       
   470 languageTextHolder
       
   471     languageTextHolder isNil ifTrue:[
       
   472         languageTextHolder := '' asValue.
       
   473     ].
       
   474     ^ languageTextHolder.
       
   475 !
       
   476 
       
   477 languageTextModifiedHolder
       
   478     languageTextModifiedHolder isNil ifTrue:[
       
   479         languageTextModifiedHolder := false asValue.
       
   480     ].
       
   481     ^ languageTextModifiedHolder.
       
   482 !
       
   483 
       
   484 languagesList
       
   485     languagesList isNil ifTrue:[
       
   486         languagesList := List withAll:(self keyStringAndLanguageSelectionTable languages).
       
   487     ].
       
   488     ^ languagesList.
       
   489 !
       
   490 
       
   491 originalTextHolder
       
   492     originalTextHolder isNil ifTrue:[
       
   493         originalTextHolder := '' asValue.
       
   494     ].
       
   495     ^ originalTextHolder.
       
   496 !
       
   497 
       
   498 originalTextModifiedHolder
       
   499     originalTextModifiedHolder isNil ifTrue:[
       
   500         originalTextModifiedHolder := false asValue.
       
   501     ].
       
   502     ^ originalTextModifiedHolder.
       
   503 !
       
   504 
       
   505 selectedKeyRow
       
   506     selectedKeyRow isNil ifTrue:[
       
   507         selectedKeyRow := ValueHolder new.
       
   508         selectedKeyRow onChangeSend:#selectionChanged to:self.
       
   509     ].
       
   510     ^ selectedKeyRow.
       
   511 !
       
   512 
       
   513 showMissingTranslationsOnly
       
   514     showMissingTranslationsOnly isNil ifTrue:[
       
   515         showMissingTranslationsOnly := false asValue.
       
   516     ].
       
   517     ^ showMissingTranslationsOnly.
       
   518 !
       
   519 
       
   520 shownLanguages
       
   521     shownLanguages isNil ifTrue:[
       
   522         shownLanguages := List new.
       
   523         shownLanguages addAll:(self languagesList).
       
   524         shownLanguages onChangeSend:#shownLanguagesChanged to:self.
       
   525     ].
       
   526     ^ shownLanguages.
       
   527 !
       
   528 
       
   529 stopApplicationIconVisibleHolder
       
   530     stopApplicationIconVisibleHolder isNil ifTrue:[
       
   531         stopApplicationIconVisibleHolder := false asValue.
       
   532     ].
       
   533     ^ stopApplicationIconVisibleHolder.
       
   534 ! !
       
   535 
       
   536 !InternationalLanguageTranslationEditor methodsFor:'initialization & release'!
       
   537 
       
   538 closeRequest
       
   539     "asks for permission before closing"
       
   540 
       
   541     self hasUnsavedChanges ifTrue:[
       
   542         (Dialog 
       
   543             confirm:(resources string:'Close without saving ?')
       
   544             default:false) ifFalse:[
       
   545             ^ self
       
   546         ]
       
   547     ].
       
   548 
       
   549     super closeRequest
       
   550 !
       
   551 
       
   552 initialize
       
   553     modified := false.
       
   554     super initialize
       
   555 !
       
   556 
       
   557 postBuildDataSet:aView
       
   558     dataSetView := aView
       
   559 ! !
       
   560 
       
   561 !InternationalLanguageTranslationEditor methodsFor:'menu actions'!
       
   562 
       
   563 addLanguage
       
   564     |lang|
       
   565 
       
   566     lang := Dialog request:'New language (ISO symbol):'.
       
   567     lang isEmptyOrNil ifTrue:[^ self].
       
   568 
       
   569     (keyStringsToLanguageMappings includesLanguage:lang) ifTrue:[^ self ].
       
   570 
       
   571     keyStringsToLanguageMappings addLanguage:lang.
       
   572     self languagesList add:lang.
       
   573     self shownLanguages add:lang.
       
   574     modified := true.
       
   575 !
       
   576 
       
   577 addTranslation
       
   578     |key index|
       
   579 
       
   580     key := Dialog request:'New Key:'.
       
   581     (keyStringsToLanguageMappings includesKey:key) ifFalse:[
       
   582         keyStringsToLanguageMappings addKey:key.
       
   583         modified := true.
       
   584     ].
       
   585     index := keyStringsToLanguageMappings indexOfKey:key.
       
   586 
       
   587     self selectedKeyRow value:index
       
   588 !
       
   589 
       
   590 extractTranslationsFromClass
       
   591     |aClass newTranslations|
       
   592 
       
   593     aClass := Dialog 
       
   594                 requestClass:'Class to extract translations from:'
       
   595                 okLabel:'OK' 
       
   596                 initialAnswer:(lastExtractedClass ? LastExtractedClass).
       
   597     aClass isNil ifTrue:[^ self ].
       
   598 
       
   599     lastExtractedClass := LastExtractedClass := aClass.
       
   600 
       
   601     newTranslations := Set new.
       
   602 
       
   603     self withWaitCursorDo:[
       
   604         "/ now, the hard part:
       
   605         "/ possible translations are in the specs,
       
   606         "/ and all arguments to (resources string:) messages.
       
   607         aClass instAndClassMethodsDo:[:eachMethod |
       
   608             newTranslations addAll:( self extractTranslationsFromMethod:eachMethod ).
       
   609         ].
       
   610     ].
       
   611 
       
   612     newTranslations := newTranslations select:[:k | k notEmpty and:[k isBlank not]].
       
   613     newTranslations := newTranslations select:[:k | (keyStringsToLanguageMappings includesKey:k) not].
       
   614     newTranslations notEmpty ifTrue:[
       
   615         newTranslations := newTranslations asSortedCollection.
       
   616         keyStringsToLanguageMappings addKeys:newTranslations.
       
   617         modified := true.
       
   618     ].
       
   619 !
       
   620 
       
   621 menuNew
       
   622     modified ifTrue:[
       
   623         (Dialog 
       
   624             confirm:(resources stringWithCRs:'Modified translations have not been changed.\\Create new translations set anyway ?')
       
   625             default:false) ifFalse:[^ self].
       
   626     ].
       
   627 
       
   628     keyStringsToLanguageMappings initialize.
       
   629     keyStringsToLanguageMappings changed.
       
   630 
       
   631     self languagesList contents:self keyStringAndLanguageSelectionTable languages.
       
   632     self shownLanguages contents:self keyStringAndLanguageSelectionTable languages.
       
   633     modified := false.
       
   634 !
       
   635 
       
   636 menuOpen
       
   637     |fn|
       
   638 
       
   639     fn := Dialog 
       
   640         requestFileName:'Name of resource file:'
       
   641         default:nil 
       
   642         pattern:'*.rs'.
       
   643 
       
   644     fn isEmptyOrNil ifTrue:[^ self ].
       
   645     fn := fn asFilename.
       
   646     fn exists ifFalse:[^ self ].
       
   647 
       
   648     self readResourceFile:fn
       
   649 !
       
   650 
       
   651 menuSave
       
   652     "This method was generated by the Browser.
       
   653      It will be invoked when the menu-item 'save' is selected."
       
   654 
       
   655     "/ change below and add any actions as required here ...
       
   656     self warn:'no action for ''save'' available.'.
       
   657 !
       
   658 
       
   659 menuSaveAs
       
   660     "This method was generated by the Browser.
       
   661      It will be invoked when the menu-item 'saveAs' is selected."
       
   662 
       
   663     "/ change below and add any actions as required here ...
       
   664     self warn:'no action for ''saveAs'' available.'.
       
   665 !
       
   666 
       
   667 openAboutThisApplication
       
   668     "This method was generated by the Browser.
       
   669      It will be invoked when the menu-item 'help-about' is selected."
       
   670 
       
   671     "/ could open a customized aboutBox here ...
       
   672     super openAboutThisApplication
       
   673 !
       
   674 
       
   675 openDocumentation
       
   676     "This method was generated by the Browser.
       
   677      It will be invoked when the menu-item 'help-documentation' is selected."
       
   678 
       
   679     "/ change below as required ...
       
   680 
       
   681     "/ to open an HTML viewer on some document (under 'doc/online/<language>/' ):
       
   682     HTMLDocumentView openFullOnDocumentationFile:'TOP.html'.
       
   683 
       
   684     "/ add application-specific help files under the 'doc/online/<language>/help/appName'
       
   685     "/ directory, and open a viewer with:
       
   686     "/ HTMLDocumentView openFullOnDocumentationFile:'help/<MyApplication>/TOP.html'.
       
   687 !
       
   688 
       
   689 readResourceFile:aFilename
       
   690     |inStream lineString|
       
   691 
       
   692     aFilename exists ifFalse:[^ self ].
       
   693 
       
   694     inStream := aFilename readStream.
       
   695     [inStream atEnd] whileFalse:[
       
   696         lineString := inStream nextLine.
       
   697         (lineString notEmpty 
       
   698         and:[ (lineString startsWith:';') not ]) ifTrue:[
       
   699             (lineString startsWith:'#encoding ') ifTrue:[
       
   700 self halt.
       
   701             ] ifFalse:[
       
   702 self halt.
       
   703             ].
       
   704         ].
       
   705     ].
       
   706     inStream close.
       
   707 !
       
   708 
       
   709 removeLanguage
       
   710     "automatically generated by UIEditor ..."
       
   711 
       
   712     "*** the code below performs no action"
       
   713     "*** (except for some feedback on the Transcript)"
       
   714     "*** Please change as required and accept in the browser."
       
   715     "*** (and replace this comment by something more useful ;-)"
       
   716 
       
   717     "action to be added ..."
       
   718 
       
   719     Transcript showCR:self class name, ': action for #removeLanguage ...'.
       
   720 !
       
   721 
       
   722 removeTranslation
       
   723     |rowSelectionIndex selectedKey|
       
   724 
       
   725     rowSelectionIndex := self selectedKeyRow value.
       
   726     rowSelectionIndex ~~ 0 ifTrue:[
       
   727         selectedKey := keyStringsToLanguageMappings keyAt:rowSelectionIndex ifAbsent:nil.
       
   728         (Dialog confirm:(resources string:'Really remove key %1' with:selectedKey)) ifTrue:[
       
   729             keyStringsToLanguageMappings removeKey:selectedKey.
       
   730         ].
       
   731     ].
       
   732 !
       
   733 
       
   734 runApplicationAndCollectTranslations
       
   735     |applicationClass newTranslations pseudoPack app|
       
   736 
       
   737     monitoredApplication notNil ifTrue:[
       
   738         monitoredApplication terminate.
       
   739         [monitoredApplication notNil] whileTrue:[
       
   740             Delay waitForSeconds:0.1
       
   741         ].
       
   742     ].
       
   743 
       
   744     applicationClass := Dialog 
       
   745                 requestClass:'Application class to start and collect translations from:'
       
   746                 okLabel:'OK' 
       
   747                 initialAnswer:(lastExtractedApplicationClass ? LastExtractedApplicationClass ).
       
   748     applicationClass isNil ifTrue:[^ self ].
       
   749 
       
   750     lastExtractedApplicationClass := LastExtractedApplicationClass := applicationClass.
       
   751 
       
   752     newTranslations := Set new.
       
   753 
       
   754     pseudoPack := AccessCollectingPseudoResourcePack new.
       
   755     pseudoPack realResourcePack:(applicationClass classResources).
       
   756 
       
   757     self stopApplicationIconVisibleHolder value:true.
       
   758 
       
   759     monitoredApplication := [
       
   760         [
       
   761             app := applicationClass new.
       
   762             app open.
       
   763             app window waitUntilVisible.
       
   764             app window waitUntilClosed.
       
   765         ] ensure:[
       
   766             app closeRequest.
       
   767             self stopApplicationIconVisibleHolder value:false.
       
   768             monitoredApplication := nil.
       
   769         ].
       
   770     ] fork.
       
   771 ! !
       
   772 
       
   773 !InternationalLanguageTranslationEditor methodsFor:'menus dynamic'!
       
   774 
       
   775 disableLanguageDisplayFor:lang
       
   776     self shownLanguages remove:lang ifAbsent:[]
       
   777 !
       
   778 
       
   779 enableLanguageDisplayFor:newLang
       
   780     |shownLanguagesInOrder|
       
   781 
       
   782     (self shownLanguages includes:newLang) ifFalse:[
       
   783         shownLanguagesInOrder := self languagesList
       
   784                                     select:[:lang | (self shownLanguages includes:lang)
       
   785                                                     or:[ lang = newLang ]].
       
   786         self shownLanguages contents:shownLanguagesInOrder.
       
   787     ]
       
   788 !
       
   789 
       
   790 isLanguageShown:lang
       
   791     ^ self shownLanguages includes:lang
       
   792 !
       
   793 
       
   794 shownLanguagesMenu
       
   795     <resource: #programMenu >
       
   796 
       
   797     ^ [
       
   798         |m selected|
       
   799 
       
   800         m := Menu new.
       
   801 
       
   802         self languagesList do:[:lang |
       
   803             |item|
       
   804 
       
   805             item := MenuItem label:lang.
       
   806             item indication:(self languageShownHolderFor:lang).
       
   807             item hideMenuOnActivated:false.    
       
   808             m addItem:item.
       
   809         ].
       
   810         m
       
   811     ].
       
   812 !
       
   813 
       
   814 toggleLanguageDisplayFor:lang
       
   815     (self shownLanguages includes:lang) ifTrue:[
       
   816         self disableLanguageDisplayFor:lang
       
   817     ] ifFalse:[
       
   818         self enableLanguageDisplayFor:lang
       
   819     ].
       
   820 ! !
       
   821 
       
   822 !InternationalLanguageTranslationEditor methodsFor:'private-key extraction'!
       
   823 
       
   824 extractTranslationsFromHelpSpecMethod:aMethod
       
   825     |codeStrings matcher parseTree resourceKeys|
       
   826 
       
   827     parseTree := RBParser 
       
   828             parseMethod:aMethod source 
       
   829             onError: [:str :pos | Transcript showCR:str. Transcript showCR:pos.
       
   830                                   nil].
       
   831     parseTree isNil ifTrue:[^ #() ].
       
   832 
       
   833     codeStrings  := 
       
   834         #(
       
   835                 '`@dict addPairsFrom: `#helpKeysAndStrings'
       
   836         ).
       
   837 
       
   838     resourceKeys := Set new.
       
   839 
       
   840     matcher := ParseTreeSearcher new.
       
   841     matcher 
       
   842         matchesAnyOf: codeStrings 
       
   843         do: [:aNode :answer |
       
   844                 |sel argNode arg|
       
   845 
       
   846                 sel := aNode selector.
       
   847                 (sel startsWith:'addPairsFrom:') ifTrue:[
       
   848                     argNode := aNode arguments at:1.
       
   849                     argNode isLiteral ifTrue:[
       
   850                         arg := argNode value.
       
   851                         arg isArray ifTrue:[
       
   852                             arg doWithIndex:[:el :index |
       
   853                                 index even ifTrue:[
       
   854                                     el isString ifTrue:[    
       
   855                                         resourceKeys add:el.
       
   856                                     ]
       
   857                                 ].
       
   858                             ].
       
   859                         ] ifFalse:[
       
   860                             Transcript 
       
   861                                 showCR:(resources 
       
   862                                         string:'Cannot derive resourceKey from non-array in %1 in %2'
       
   863                                         with:argNode formattedCode
       
   864                                         with:aMethod selector).
       
   865                         ].
       
   866                     ] ifFalse:[
       
   867                         Transcript 
       
   868                             showCR:(resources 
       
   869                                         string:'Cannot derive resourceKey from non-literal: %1 in %2'
       
   870                                         with:argNode formattedCode
       
   871                                         with:aMethod selector).
       
   872                     ].
       
   873                 ].
       
   874                 aNode
       
   875             ].
       
   876 
       
   877     matcher executeTree: parseTree initialAnswer: nil.
       
   878     ^ resourceKeys
       
   879 !
       
   880 
       
   881 extractTranslationsFromMenuSpecMethod:aMethod
       
   882     |menu resourceKeys|
       
   883 
       
   884     menu := aMethod mclass theNonMetaclass perform:aMethod selector.
       
   885     menu isNil ifTrue:[ ^ #() ].
       
   886 
       
   887     (menu isKindOf:Menu) ifFalse:[
       
   888         menu := Menu new fromLiteralArrayEncoding:menu
       
   889     ].
       
   890 
       
   891     resourceKeys := Set new.
       
   892     menu allItemsDo:[:aMenuItem |
       
   893         aMenuItem translateLabel ifTrue:[
       
   894             aMenuItem isSeparatorItem ifFalse:[
       
   895                 resourceKeys add:aMenuItem label.
       
   896             ]
       
   897         ]
       
   898     ].
       
   899     ^ resourceKeys
       
   900 !
       
   901 
       
   902 extractTranslationsFromMethod:aMethod
       
   903     |mResources|
       
   904 
       
   905     mResources := aMethod resources.
       
   906     mResources notNil ifTrue:[
       
   907         (mResources includesKey:#menu) ifTrue:[
       
   908              ^ self extractTranslationsFromMenuSpecMethod:aMethod.
       
   909         ].
       
   910         (mResources includesKey:#canvas) ifTrue:[
       
   911              ^ self extractTranslationsFromUISpecMethod:aMethod.
       
   912         ].
       
   913         (mResources includesKey:#help) ifTrue:[
       
   914              ^ self extractTranslationsFromHelpSpecMethod:aMethod.
       
   915         ].
       
   916         (mResources includesKey:#tableColumns) ifTrue:[
       
   917              ^ self extractTranslationsFromTableColumnsSpecMethod:aMethod.
       
   918         ].
       
   919 
       
   920         ^ self extractTranslationsFromSpecMethod:aMethod.
       
   921     ].
       
   922     ^ self extractTranslationsFromMethodsCode:aMethod
       
   923 !
       
   924 
       
   925 extractTranslationsFromMethodsCode:aMethod
       
   926 "/method:mthd selector:sel inClass:cls matchesParseTreeMatcher:aMatcher
       
   927     |codeStrings matcher parseTree resourceKeys|
       
   928 
       
   929     parseTree := RBParser 
       
   930             parseMethod:aMethod source 
       
   931             onError: [:str :pos | Transcript showCR:str. Transcript showCR:pos.
       
   932                                   nil].
       
   933     parseTree isNil ifTrue:[^ #() ].
       
   934 
       
   935     codeStrings  := 
       
   936         #(
       
   937                 'resources `@msg: `@args'
       
   938                 'self resources `@msg: `@args'
       
   939                 'self class resources `@msg: `@args'
       
   940                 'self classResources `@msg: `@args'
       
   941         ).
       
   942 
       
   943     resourceKeys := Set new.
       
   944 
       
   945     matcher := ParseTreeSearcher new.
       
   946     matcher 
       
   947         matchesAnyOf: codeStrings 
       
   948         do: [:aNode :answer |
       
   949                 |sel keyStringArgNode keyStringArg|
       
   950 
       
   951                 sel := aNode selector.
       
   952                 ((sel startsWith:'string:') or:[(sel startsWith:'at:')]) ifTrue:[
       
   953                     keyStringArgNode := aNode arguments at:1.
       
   954                     keyStringArgNode isLiteral ifTrue:[
       
   955                         keyStringArg := keyStringArgNode value.
       
   956                         keyStringArg isString ifTrue:[
       
   957                             resourceKeys add:keyStringArg.
       
   958                         ] ifFalse:[
       
   959                             Transcript 
       
   960                                 showCR:(resources 
       
   961                                         string:'Cannot derive resourceKey from non-string: %1 in %2'
       
   962                                         with:keyStringArgNode formattedCode
       
   963                                         with:aMethod selector).
       
   964                         ].
       
   965                     ] ifFalse:[
       
   966                         Transcript 
       
   967                             showCR:(resources 
       
   968                                         string:'Cannot derive resourceKey from non-literal: %1 in %2'
       
   969                                         with:keyStringArgNode formattedCode
       
   970                                         with:aMethod selector).
       
   971                     ].
       
   972                 ].
       
   973                 aNode
       
   974             ].
       
   975 
       
   976     matcher executeTree: parseTree initialAnswer: nil.
       
   977     ^ resourceKeys
       
   978 !
       
   979 
       
   980 extractTranslationsFromSpecMethod:aMethod
       
   981     ^ #()
       
   982 !
       
   983 
       
   984 extractTranslationsFromTableColumnsSpecMethod:aMethod
       
   985     |columnDescription resourceKeys|
       
   986 
       
   987     columnDescription := aMethod mclass theNonMetaclass perform:aMethod selector.
       
   988     columnDescription isNil ifTrue:[ ^ #() ].
       
   989 
       
   990     (columnDescription first isKindOf:DataSetColumnSpec) ifFalse:[
       
   991         columnDescription := columnDescription collect:[:el | DataSetColumnSpec new fromLiteralArrayEncoding:el].
       
   992     ].
       
   993 
       
   994     resourceKeys := Set new.
       
   995     columnDescription do:[:aColumnSpec |
       
   996         aColumnSpec translateLabel ifTrue:[
       
   997             resourceKeys add:aColumnSpec label.
       
   998         ]
       
   999     ].
       
  1000     ^ resourceKeys
       
  1001 !
       
  1002 
       
  1003 extractTranslationsFromUISpecMethod:aMethod
       
  1004     |spec resourceKeys visitor|
       
  1005 
       
  1006     spec := aMethod mclass theNonMetaclass perform:aMethod selector.
       
  1007     spec isNil ifTrue:[ ^ #() ].
       
  1008 
       
  1009     (spec isKindOf:UISpecification) ifFalse:[
       
  1010         spec := UISpecification from:spec
       
  1011     ].
       
  1012 
       
  1013     resourceKeys := Set new.
       
  1014 
       
  1015     visitor := UISpecVisitor new.
       
  1016     spec acceptVisitor:visitor.
       
  1017 
       
  1018     ^ visitor translatedLabels
       
  1019 ! !
       
  1020 
       
  1021 !InternationalLanguageTranslationEditor methodsFor:'queries'!
       
  1022 
       
  1023 hasUnsavedChanges
       
  1024     ^ modified
       
  1025 ! !
       
  1026 
       
  1027 !InternationalLanguageTranslationEditor methodsFor:'specs-dynamic'!
       
  1028 
       
  1029 columnInRow:row at:colIndex
       
  1030     |lang|
       
  1031 
       
  1032     lang := self languageAtCol:colIndex.
       
  1033     ^ row atLanguage:lang
       
  1034 !
       
  1035 
       
  1036 getBackgroundForRow:row rowNr:rowNr col:colIndex
       
  1037     |lang|
       
  1038 
       
  1039     colIndex == 1 ifTrue:[^ nil].
       
  1040     lang := self languageAtCol:colIndex.
       
  1041     ^ (row atLanguage:lang) isNil ifTrue:[Color red lightened] ifFalse:nil
       
  1042 !
       
  1043 
       
  1044 keyStringAndLanguageSelectionTableColumnDescription
       
  1045     |spec|
       
  1046 
       
  1047     spec := OrderedCollection new.
       
  1048 
       
  1049     spec add:
       
  1050       #(DataSetColumnSpec
       
  1051          label: 'Key'
       
  1052          labelAlignment: center
       
  1053          labelButtonType: Button
       
  1054          minWidth: 50
       
  1055          model: keyStringInRow:
       
  1056          isResizeable: true
       
  1057          canSelect: true
       
  1058          showRowSeparator: true
       
  1059          showColSeparator: true
       
  1060        ).
       
  1061 
       
  1062     self shownLanguages do:[:lang |
       
  1063         |entry|
       
  1064 
       
  1065         entry :=
       
  1066               #(DataSetColumnSpec
       
  1067                  label: lang
       
  1068                  labelAlignment: center
       
  1069                  labelButtonType: Button
       
  1070                  minWidth: 50
       
  1071                  model: #columnInRow:at:
       
  1072                  canSelect: true
       
  1073                  isResizeable: true
       
  1074                  showRowSeparator: true
       
  1075                  showColSeparator: true
       
  1076                  backgroundSelector: #getBackgroundForRow:rowNr:col:
       
  1077                ).
       
  1078         entry := entry copy.
       
  1079         entry replaceAll:#lang with:lang.
       
  1080         spec add: entry 
       
  1081     ].
       
  1082     ^ spec
       
  1083 !
       
  1084 
       
  1085 keyStringInRow:row
       
  1086     ^ row keyString
       
  1087 ! !
       
  1088 
       
  1089 !InternationalLanguageTranslationEditor methodsFor:'user actions'!
       
  1090 
       
  1091 selectionChanged
       
  1092     |rowSelectionIndex colSelectionIndex language selectedKey originalText languageText
       
  1093      answer|
       
  1094 
       
  1095     colSelectionIndex := dataSetView selectedColIndex.
       
  1096     language := colSelectionIndex > 1 ifTrue:[ shownLanguages at:colSelectionIndex-1 ] ifFalse:nil.
       
  1097 
       
  1098     rowSelectionIndex := self selectedKeyRow value.
       
  1099     rowSelectionIndex ~~ 0 ifTrue:[
       
  1100         selectedKey := keyStringsToLanguageMappings keyAt:rowSelectionIndex.
       
  1101         originalText := selectedKey storeString.
       
  1102         language notNil ifTrue:[
       
  1103             languageText := keyStringsToLanguageMappings at:selectedKey language:language.
       
  1104             languageText notNil ifTrue:[
       
  1105                 languageText := languageText storeString.
       
  1106             ]
       
  1107         ]
       
  1108     ].
       
  1109 
       
  1110     self originalTextModifiedHolder value ifTrue:[ 
       
  1111         answer := OptionBox 
       
  1112                       request:'Accept changed original text (key) ?' 
       
  1113                       label:'Original text (key) changed'
       
  1114                       image:(WarningBox iconBitmap)
       
  1115                       buttonLabels:#('Cancel' 'Accept' 'Accept As New')
       
  1116                       values:#(nil #accept #acceptAsNew)
       
  1117                       default:#acceptAsNew.
       
  1118 
       
  1119         answer isNil ifTrue:[^ self ].
       
  1120         answer == #accept ifTrue:[
       
  1121 self halt.        ].
       
  1122         answer == #acceptAsNew ifTrue:[
       
  1123 self halt.        ].
       
  1124     ].
       
  1125     self languageTextModifiedHolder value ifTrue:[ self halt.
       
  1126         (Dialog confirm:'Accept changed translation ?') ifTrue:[
       
  1127             self halt.
       
  1128         ]
       
  1129     ].
       
  1130 
       
  1131     self originalTextHolder value:originalText.
       
  1132     self languageTextHolder value:languageText.
       
  1133 
       
  1134     self originalTextModifiedHolder value:false.
       
  1135     self languageTextModifiedHolder value:false.
       
  1136 !
       
  1137 
       
  1138 shownLanguagesChanged
       
  1139     self keyStringAndLanguageSelectionTableColumnDescriptionHolder 
       
  1140         value:(self keyStringAndLanguageSelectionTableColumnDescription).
       
  1141 !
       
  1142 
       
  1143 stopApplication
       
  1144     |p|
       
  1145 
       
  1146     (p := monitoredApplication) notNil ifTrue:[
       
  1147         p terminate.
       
  1148     ].
       
  1149 ! !
       
  1150 
       
  1151 !InternationalLanguageTranslationEditor::AccessCollectingPseudoResourcePack methodsFor:'accessing'!
       
  1152 
       
  1153 realResourcePack:something
       
  1154     realResourcePack := something.
       
  1155 ! !
       
  1156 
       
  1157 !InternationalLanguageTranslationEditor::KeyStringsToLanguageMappings class methodsFor:'instance creation'!
       
  1158 
       
  1159 new
       
  1160     ^ self basicNew initialize
       
  1161 ! !
       
  1162 
       
  1163 !InternationalLanguageTranslationEditor::KeyStringsToLanguageMappings methodsFor:'accessing'!
       
  1164 
       
  1165 addKey:aKey
       
  1166     keys add:aKey.
       
  1167     self changed.
       
  1168 !
       
  1169 
       
  1170 addKeys:aCollectionOfKey
       
  1171     keys addAll:aCollectionOfKey.
       
  1172     self changed.
       
  1173 !
       
  1174 
       
  1175 addLanguage:lang
       
  1176     languages add:lang.
       
  1177     languageMappings at:lang put:(Dictionary new).
       
  1178 !
       
  1179 
       
  1180 at:aKey language:language
       
  1181     ^ (languageMappings at:language) at:aKey ifAbsent:nil
       
  1182 !
       
  1183 
       
  1184 at:aKey language:language put:value
       
  1185     self addKey:aKey.
       
  1186     ^ (languageMappings at:language) at:aKey put:value
       
  1187 !
       
  1188 
       
  1189 keyAt:index
       
  1190     ^ keys at:index.
       
  1191 !
       
  1192 
       
  1193 keyAt:index ifAbsent:exceptionalValue
       
  1194     ^ keys at:index ifAbsent:exceptionalValue.
       
  1195 !
       
  1196 
       
  1197 keys
       
  1198     ^ keys
       
  1199 !
       
  1200 
       
  1201 languages
       
  1202     ^ languages
       
  1203 !
       
  1204 
       
  1205 removeKey:aKey
       
  1206     keys remove:aKey ifAbsent:[].
       
  1207     languageMappings do:[:eachMapping |
       
  1208         eachMapping removeKey:aKey ifAbsent:[].
       
  1209     ].
       
  1210     self changed.
       
  1211 !
       
  1212 
       
  1213 size
       
  1214     ^ keys size
       
  1215 ! !
       
  1216 
       
  1217 !InternationalLanguageTranslationEditor::KeyStringsToLanguageMappings methodsFor:'enumerating'!
       
  1218 
       
  1219 do:aBlock
       
  1220     keys do:[:eachKey |
       
  1221         aBlock value:(InternationalLanguageTranslationEditor::LanguageMappingRow new 
       
  1222                                 key:eachKey; mappings:self).
       
  1223     ].
       
  1224 ! !
       
  1225 
       
  1226 !InternationalLanguageTranslationEditor::KeyStringsToLanguageMappings methodsFor:'initialization'!
       
  1227 
       
  1228 initialize
       
  1229     super initialize.
       
  1230 
       
  1231     keys := OrderedSet new.
       
  1232     languages := OrderedCollection new.
       
  1233     languageMappings := Dictionary new.
       
  1234 
       
  1235     keys add:'open'.
       
  1236     keys add:'close'.
       
  1237     keys add:'yes'.
       
  1238     keys add:'no'.
       
  1239 
       
  1240     self addLanguage:#'de'.
       
  1241     self addLanguage:#'fr'.
       
  1242 
       
  1243     self at:'open' language:#'de' put:'öffnen'.    
       
  1244     self at:'close' language:#'de' put:'schliessen'.    
       
  1245     self at:'yes' language:#'de' put:'ja'.    
       
  1246     self at:'no' language:#'de' put:'nein'.    
       
  1247     self at:'cancel' language:#'de' put:'abbrechen'.    
       
  1248 
       
  1249     self at:'open' language:#'fr' put:'ouvrir'.    
       
  1250     self at:'close' language:#'fr' put:'fermer'.    
       
  1251     self at:'yes' language:#'fr' put:'oui'.    
       
  1252     self at:'no' language:#'fr' put:'non'.    
       
  1253 ! !
       
  1254 
       
  1255 !InternationalLanguageTranslationEditor::KeyStringsToLanguageMappings methodsFor:'private'!
       
  1256 
       
  1257 atLanguage:lang
       
  1258     ^ languageMappings at:lang
       
  1259 !
       
  1260 
       
  1261 atLanguageIndex:idx
       
  1262     |lang|
       
  1263 
       
  1264     lang := languages at:idx.
       
  1265     ^ self atLanguage:lang.
       
  1266 ! !
       
  1267 
       
  1268 !InternationalLanguageTranslationEditor::KeyStringsToLanguageMappings methodsFor:'queries'!
       
  1269 
       
  1270 includesKey:aKey
       
  1271     ^ keys includes:aKey
       
  1272 !
       
  1273 
       
  1274 includesLanguage:lang
       
  1275     ^ languages includes:lang
       
  1276 !
       
  1277 
       
  1278 indexOfKey:aKey
       
  1279     ^ keys indexOf:aKey
       
  1280 ! !
       
  1281 
       
  1282 !InternationalLanguageTranslationEditor::LanguageMappingRow methodsFor:'accessing'!
       
  1283 
       
  1284 atLanguage:language
       
  1285     ^ (mappings atLanguage:language) at: key ifAbsent:nil
       
  1286 !
       
  1287 
       
  1288 columnAt:columnNr
       
  1289     ^ (mappings atLanguageIndex:columnNr-1) at: key ifAbsent:nil
       
  1290 !
       
  1291 
       
  1292 key:something
       
  1293     key := something.
       
  1294 !
       
  1295 
       
  1296 keyString
       
  1297     ^ key
       
  1298 !
       
  1299 
       
  1300 mappings:something
       
  1301     mappings := something.
       
  1302 ! !
       
  1303 
       
  1304 !InternationalLanguageTranslationEditor::UISpecVisitor methodsFor:'accessing'!
       
  1305 
       
  1306 translatedLabels
       
  1307     ^ translatedLabels ? #()
       
  1308 ! !
       
  1309 
       
  1310 !InternationalLanguageTranslationEditor::UISpecVisitor methodsFor:'visiting'!
       
  1311 
       
  1312 visitObject:anObject with:aParameter
       
  1313     (anObject isKindOf:UISpecification) ifTrue:[
       
  1314         (anObject respondsTo:#translateLabel) ifTrue:[
       
  1315             anObject translateLabel == true ifTrue:[
       
  1316                 translatedLabels isNil ifTrue:[
       
  1317                     translatedLabels := Set new.
       
  1318                 ].
       
  1319                 translatedLabels add:anObject label.
       
  1320             ].
       
  1321         ].
       
  1322     ].
       
  1323     self visitChildrenOf:anObject.
       
  1324 ! !
       
  1325 
       
  1326 !InternationalLanguageTranslationEditor class methodsFor:'documentation'!
       
  1327 
       
  1328 version
       
  1329     ^ '$Header$'
       
  1330 ! !