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