Tools__InternationalLanguageTranslationEditor.st
author mawalch
Wed, 02 Aug 2017 17:10:03 +0200
changeset 3454 5488b2613628
parent 3448 e4a15fd6bec5
child 3455 4ba13182f80f
permissions -rw-r--r--
#BUGFIX by mawalch
class: Tools::InternationalLanguageTranslationEditor
changed: #extractTranslationsFromProject

Suggestions must be nil or a SequenceableCollection of packages (not a Symbol, which is a SequenceableCollection, too).
mawalch@3454
     1
"{ Encoding: utf8 }"
mawalch@3454
     2
cg@2015
     3
"{ Package: 'stx:libtool2' }"
cg@2015
     4
cg@2015
     5
"{ NameSpace: Tools }"
cg@2015
     6
cg@2015
     7
ApplicationModel subclass:#InternationalLanguageTranslationEditor
cg@2015
     8
	instanceVariableNames:'languagesList keyStringsToLanguageMappings languageTextHolder
cg@2015
     9
		originalTextHolder modified shownLanguages selectedKeyRow
cg@2015
    10
		showMissingTranslationsOnly
cg@2015
    11
		keyStringAndLanguageSelectionTableColumnDescriptionHolder
cg@2015
    12
		languageShownHolders dataSetView lastExtractedClass
cg@2015
    13
		lastExtractedApplicationClass stopApplicationIconVisibleHolder
cg@2015
    14
		monitoredApplication originalTextModifiedHolder
cg@2048
    15
		languageTextModifiedHolder languageTextAcceptHolder
cg@2048
    16
		inSingleFileMode lastExtractedProject lastLanguage
fm@2050
    17
		lastSelectedKey autoAcceptHolder languageEditor
fm@2050
    18
		selectedColIndexHolder exampleLanguageSelectionHolder
fm@2051
    19
		exampleLanguageTextHolder pastePreviousTranslationEnableHolder
fm@2163
    20
		searchForSimilarTranslationEnableHolder alwaysWriteUTF8Holder
fm@2327
    21
		lastNameSpace pasteOriginalEnableHolder ignoreCaseHolder
fm@2327
    22
		closeSearchBar searchTextModifiedHolder searchNextText
fm@2327
    23
		searchBarImageInfoLabelHolder searchPreviousText searchBoxVisible
fm@2327
    24
		searchBarInfoLabelHolder searchTextHolder searchTextView
cg@3286
    25
		searchBoxView translationsPanel lastPackage methodsUsingKey'
cg@2032
    26
	classVariableNames:'LastExtractedClass LastExtractedApplicationClass
cg@2410
    27
		LastExtractedProject LastProject'
cg@2015
    28
	poolDictionaries:''
cg@2015
    29
	category:'Interface-UIPainter'
cg@2015
    30
!
cg@2015
    31
cg@2015
    32
Object subclass:#AccessCollectingPseudoResourcePack
cg@3286
    33
	instanceVariableNames:'collectedKeys realResourcePack watchingTranslationEditor'
cg@2015
    34
	classVariableNames:''
cg@2015
    35
	poolDictionaries:''
cg@2015
    36
	privateIn:InternationalLanguageTranslationEditor
cg@2015
    37
!
cg@2015
    38
cg@2015
    39
Collection subclass:#KeyStringsToLanguageMappings
cg@2032
    40
	instanceVariableNames:'keys keyInfo perLanguageInfo perLanguageMappings languageMappings
fm@2049
    41
		languages rowPerKey'
cg@2015
    42
	classVariableNames:''
cg@2015
    43
	poolDictionaries:''
cg@2015
    44
	privateIn:InternationalLanguageTranslationEditor
cg@2015
    45
!
cg@2015
    46
cg@2015
    47
Object subclass:#LanguageMappingRow
cg@2015
    48
	instanceVariableNames:'key mappings'
cg@2015
    49
	classVariableNames:''
cg@2015
    50
	poolDictionaries:''
cg@2015
    51
	privateIn:InternationalLanguageTranslationEditor
cg@2015
    52
!
cg@2015
    53
cg@2015
    54
Visitor subclass:#UISpecVisitor
cg@2015
    55
	instanceVariableNames:'translatedLabels'
cg@2015
    56
	classVariableNames:''
cg@2015
    57
	poolDictionaries:''
cg@2015
    58
	privateIn:InternationalLanguageTranslationEditor
cg@2015
    59
!
cg@2015
    60
cg@2015
    61
!InternationalLanguageTranslationEditor class methodsFor:'documentation'!
cg@2015
    62
cg@2015
    63
documentation
cg@2015
    64
"
cg@2015
    65
    documentation to be added.
cg@2015
    66
cg@2015
    67
    [author:]
cg@2434
    68
	cg (cg@FUSI)
cg@2015
    69
cg@2015
    70
    [instance variables:]
cg@2015
    71
cg@2015
    72
    [class variables:]
cg@2015
    73
cg@2015
    74
    [see also:]
cg@2015
    75
cg@2015
    76
"
cg@2015
    77
!
cg@2015
    78
cg@2015
    79
examples
cg@2015
    80
"
cg@2015
    81
  Starting the application:
cg@2434
    82
								[exBegin]
cg@2015
    83
    InternationalLanguageTranslationEditor open
cg@2015
    84
cg@2434
    85
								[exEnd]
cg@2015
    86
cg@2015
    87
  more examples to be added:
cg@2434
    88
								[exBegin]
cg@2434
    89
    ... add code fragment for
cg@2015
    90
    ... executable example here ...
cg@2434
    91
								[exEnd]
cg@2015
    92
"
cg@2015
    93
!
cg@2015
    94
cg@2015
    95
history
cg@2015
    96
    "Created: / 04-03-2006 / 09:07:19 / cg"
cg@2015
    97
! !
cg@2015
    98
cg@3286
    99
!InternationalLanguageTranslationEditor class methodsFor:'help spec'!
cg@3286
   100
cg@3286
   101
flyByHelpSpec
cg@3286
   102
    <resource: #help>
cg@3286
   103
cg@3286
   104
    ^ super flyByHelpSpec addPairsFrom:#(
cg@3286
   105
cg@3286
   106
#searchBox
cg@3286
   107
'Show a search box at the bottom to search for substrings in the string keys'
cg@3286
   108
cg@3286
   109
#browseReferringMethods
cg@3286
   110
'Browse methods which refer to this string'
cg@3286
   111
cg@3286
   112
)
cg@3286
   113
! !
cg@3286
   114
cg@3286
   115
!InternationalLanguageTranslationEditor class methodsFor:'help specs'!
cg@3286
   116
cg@3286
   117
helpSpec
cg@3286
   118
    "This resource specification was automatically generated
cg@3286
   119
     by the UIHelpTool of ST/X."
cg@3286
   120
cg@3286
   121
    "Do not manually edit this!! If it is corrupted,
cg@3286
   122
     the UIHelpTool may not be able to read the specification."
cg@3286
   123
cg@3286
   124
    "
cg@3286
   125
     UIHelpTool openOnClass:Tools::InternationalLanguageTranslationEditor    
cg@3286
   126
    "
cg@3286
   127
cg@3286
   128
    <resource: #help>
cg@3286
   129
cg@3286
   130
    ^ super helpSpec addPairsFrom:#(
cg@3286
   131
cg@3286
   132
#searchBox
cg@3286
   133
''
cg@3286
   134
cg@3286
   135
)
cg@3286
   136
! !
cg@3286
   137
fm@2327
   138
!InternationalLanguageTranslationEditor class methodsFor:'image specs'!
fm@2327
   139
fm@2327
   140
closeSearchBarIcon
fm@2327
   141
    "This resource specification was automatically generated
fm@2327
   142
     by the ImageEditor of ST/X."
fm@2327
   143
fm@2327
   144
    "Do not manually edit this!! If it is corrupted,
fm@2327
   145
     the ImageEditor may not be able to read the specification."
fm@2327
   146
fm@2327
   147
    "
fm@2327
   148
     self closeSearchBar inspect
fm@2327
   149
     ImageEditor openOnClass:self andSelector:#closeSearchBar
fm@2327
   150
     Icon flushCachedIcons
fm@2327
   151
    "
fm@2327
   152
fm@2327
   153
    <resource: #image>
fm@2327
   154
fm@2327
   155
    ^Icon
cg@2434
   156
	constantNamed:#'Psiware::SystemManagement class closeSearchBar'
cg@2434
   157
	ifAbsentPut:[(Depth8Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#[8]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
fm@2327
   158
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@GQ\SD1LSD1LSD1LSD1LWGP@@@@@@
fm@2327
   159
@ATGA@HA@PDA@PDA@PHDA1T@@@@@@@@TAENG!!(VB XA?_''57QPPT@@@@@@@@E NJ^V)&X%)UTT5IV7 KE @@@@@@@A A"7Q,#&9VS%^MQ$E<DQ @@@@@@@@Z
fm@2327
   160
@X%-#9NRX52R$80:^1@Z@@@@@@@@F0FHY6>R$9JR$9ION''(PF0@@@@@@@A<A 5ABT)FS$9D=KR13C1<@@@@@@@@)@WUCND*Q$9NQM"T!!XP8)@@@@@@@@K E2
fm@2327
   161
O4RQ$9FQ$9@2G%8JK @@@@@@@CLA\S2D$9D9M)BS]!!1]BSL@@@@@@@@7@W@5LXP6J2\2]"P"VP 7@@@@@@@@O U+R3@*I2T#HA0&N5 RO @@@@@@@D LPF%(
fm@2327
   162
YVQ W59]VU 4CD @@@@@@@AGFP4F@PDA@PDA@PDFCQ%G@@@@@@@@K41TUEQTUEQTUEQTUEQLK0@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
fm@2327
   163
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@a') ; colorMapFromArray:#[0 0 0 167 25 15 170 49 40 171 50 39 174 68 60 176 56 48 176 58 49 183 118 110 184 45 32 184 46 32 184 47 34 184 71 58 184 85 78 184 86 79 185 53 39 186 57 42 186 59 43 186 60 45 186 68 58 190 187 180 192 188 181 193 189 182 194 190 183 195 192 184 197 194 186 202 148 142 202 199 191 205 202 195 207 64 48 207 203 195 208 65 49 208 205 198 209 65 49 209 66 49 209 69 52 210 66 49 210 78 64 211 67 51 211 71 54 212 69 51 212 208 200 212 208 202 213 69 52 213 70 52 213 79 57 215 80 59 215 212 206 217 214 207 218 79 62 218 84 67 219 107 95 219 216 210 221 84 63 221 84 67 221 109 96 221 218 213 222 76 56 222 110 96 222 113 79 223 87 67 223 87 70 223 115 99 224 221 216 225 89 72 225 105 91 225 117 84 227 89 64 227 91 73 227 112 98 227 115 95 227 122 92 227 224 219 227 225 219 228 113 83 228 113 99 229 102 87 229 226 221 230 115 84 230 117 81 230 142 117 231 102 80 231 116 86 231 120 103 231 131 119 231 228 224 232 118 88 232 119 82 233 143 117 234 99 76 234 102 79 234 119 89 234 127 100 234 145 119 235 104 82 235 106 86 236 108 89 236 110 92 236 113 92 236 121 91 236 146 119 237 113 95 237 115 98 237 122 92 237 132 100 238 117 101 238 119 104 238 123 93 238 123 109 238 131 98 238 133 102 238 146 120 238 148 121 239 125 112 239 127 115 239 129 118 239 131 105 239 134 102 240 135 122 240 200 196 242 135 113 242 141 116 242 141 119 242 145 116 242 147 118 242 148 120 243 137 115 243 138 118 243 141 121 243 142 123 243 144 126 243 145 129 243 151 134 243 202 197 244 147 132 244 149 135 244 152 137 244 163 142 244 164 145 245 160 143 245 164 146 245 213 204 246 213 203 248 215 205 249 215 206 252 244 243 253 244 243 253 247 245 255 255 255]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@G?? G?? G?? G?? G?? G?? G?? G?? G?? G?? G?? G?? G?? G?? G?? G?? @@@@@@@@@@@@') ; yourself); yourself]
fm@2327
   164
fm@2327
   165
    "Created: / 15-06-2007 / 18:04:38 / Administrador"
fm@2327
   166
!
fm@2327
   167
fm@2327
   168
restartSearchBarIcon
fm@2327
   169
    "This resource specification was automatically generated
fm@2327
   170
     by the ImageEditor of ST/X."
fm@2327
   171
fm@2327
   172
    "Do not manually edit this!! If it is corrupted,
fm@2327
   173
     the ImageEditor may not be able to read the specification."
fm@2327
   174
fm@2327
   175
    "
fm@2327
   176
     self restartSearchBarIcon inspect
fm@2327
   177
     ImageEditor openOnClass:self andSelector:#restartSearchBarIcon
fm@2327
   178
     Icon flushCachedIcons
fm@2327
   179
    "
fm@2327
   180
fm@2327
   181
    <resource: #image>
fm@2327
   182
fm@2327
   183
    ^Icon
cg@2434
   184
	constantNamed:#'Psiware::SystemManagement class restartSearchBarIcon'
cg@2434
   185
	ifAbsentPut:[(Depth24Image new) width: 20; height: 20; photometric:(#rgb); bitsPerSample:(#[8 8 8]); samplesPerPixel:(3); bits:(ByteArray fromPackedString:'
fm@2327
   186
@@@@@@@@@@@@@@@@@@@@@@@@?>SX?>''V?>;)?>O!!?>G]?>WY@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@?=3\:[>''5;JF/Y-.+XY),(U.
fm@2327
   187
6JZK?=J1?>V<>.+I@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@?>?'':+:!!19]U6*-Q?]Y/?>RC?>*!!?>F_>+=939UL2Y!!L>MJT??W[@@@@@@@@@@@@@@@@@@@@
fm@2327
   188
@@@@??[-=\^&1IEP=<Q[?>1/?=5$?=52?>NT?=^Q?>BP?>FG>;1]6JEO8;^H?]3I@@@@@@@@@@@@@@@@@@@@?\*95Y-)<+!!$??.F?>)17+-U8,E40Y-.09I)
fm@2327
   189
:Z1-?=I??=)8?<1.>K597;NL??K,@@@@@@@@@@@@?=#M6I>B>+:@?>2U=,]]5[IN7,^C5LB[<MWL?]#O=,BZ7)=\>;Y[??FP?=>O1YEW8<B$;=WH@@@@@@@@
fm@2327
   190
>,"%8Z:A?>N#?>._5KA$9-JW7=+FX6M+V%U3"''*T0Y>V4ZA7595T=;1"?=&D?=&L,W(93IU\:KE9=LBG9[Q9;K1<?=^R:K591*-6??''[@@@@RE%37>7?=?/?
fm@2327
   191
>^_''3*.M0YAU<K5,?>ZO?=>G?<!!6?<Y6>+U(69YI3:IG?=Z@?>NU5:=19,6%@@@@@@@@OU5*2.+7;O??5-KF2;JS?=*&?>&"?=.E?>2R?=&F?>"X8I-N5)ED
fm@2327
   192
29$&?>M:?=*F3:E&>]/A@@@@@@@@O5=.7O??5^/(?O++<M.>0I-/;LNE??2)?=&B?>^%,W)A8:14?=FX3)TR?>U/?=Q:3IAZ?=?T@@@@@@@@P5Y68_#?7.70
fm@2327
   193
??[1??C_:,F%6;A=>MJA?>6":,6+&G91?>+^?>+]79<$?<1\?=:C5IM[?<;F@@@@@@@@Q$1>6N_?<?+?<.W.?>3*??S(=,.(2Z!!#=-:^+9>P4,[P<>''46=O^
fm@2327
   194
=+MX;Z)O?>^Q:Z]*;+Z''@@@@@@@@TD:O9^/?;/C??>???>/:?>71?>7Z;]^%0+JA7=CI8]O"0+[D8=#&?<&V79="?=2L?\E88[BG@@@@@@@@VU&M=_3?9N''?
fm@2327
   195
>/C???K??NK/??[1???#9M?B??3;(IV#/[WD;^_5@@@@;KR]<[10?=Q68[9,8,>W@@@@TU9&;/??9__9:.;/?_#<??/?>?[==?79>_?=<_S9T5M[0,WN7^G*
fm@2327
   196
@@@@@@@@1Y= >=!!>9,]-3[],6]B''TEH=;O_''=O?6>O77>O''=>//?=_+?:O_?:_''?>O??SEM[/<[P6.O,@@@@@@@@8-F%1*%/9[>@?>R(7+VG_%,;\E]CW$=H
fm@2327
   197
U5AWV5%.U5);R5M:Q5M;S%-=TE]*[GI>):696M;*@@@@@@@@@@@@6\F[2Y914)9.;[VF?L"!!8[^_3J>''0KB:0;?V0,_''-<C),K/(,;7!!+[OI,K[D2=G_9N+8
fm@2327
   198
@@@@@@@@@@@@@@@@@@@@?\*_7*]>3))5/II9+9FF+9> 0;7I5-#-7NO?7^#?8^/?:/G?7NK07>W3@@@@@@@@@@@@@@@@@@@@@@@@?>N;?>N;?=:9?>7T?>#X
fm@2327
   199
>^_%=N?6<OK?@@@@@@@@@@@@@@@@@@@@@@@@@@@@') ; mask:((Depth1Image new) width: 20; height: 20; photometric:(#blackIs0); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@?@OC?0OO?8O_?<O_?>O???O?????_??>_??>_??>_??>_??>_??>_??__??O???O???G???A??/A? O') ; yourself); yourself]
fm@2327
   200
!
fm@2327
   201
fm@2327
   202
searchNextIcon
fm@2327
   203
    "This resource specification was automatically generated
fm@2327
   204
     by the ImageEditor of ST/X."
fm@2327
   205
fm@2327
   206
    "Do not manually edit this!! If it is corrupted,
fm@2327
   207
     the ImageEditor may not be able to read the specification."
fm@2327
   208
fm@2327
   209
    "
fm@2327
   210
     self searchNextIcon inspect
fm@2327
   211
     ImageEditor openOnClass:self andSelector:#searchNextIcon
fm@2327
   212
     Icon flushCachedIcons
fm@2327
   213
    "
fm@2327
   214
fm@2327
   215
    <resource: #image>
fm@2327
   216
fm@2327
   217
    ^Icon
cg@2434
   218
	constantNamed:#'Psiware::SystemManagement class searchNextIcon'
cg@2434
   219
	ifAbsentPut:[(Depth8Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#[8]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
fm@2327
   220
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ZE)ZZ@@@@@@@@@@@@@@@
fm@2327
   221
@@@@@@AFF XA@PXUQ @@@@@@@@@@@@@@@@@*@Q5G^WX6E0D*@@@@@@@@@@@@@@@,AVQ?\&1#W&X8@20@@@@@@@@@@@A[@U==\F-"VUQOUSLAV0@@@@@@@@@@
fm@2327
   222
G19-D <NCP0KB!!@7D1<@@@@@@@@@  ]MT5JY&Y&Y&Y%RLR4G  @@@@@@@H\A WL $)&Y&Y&RF35B@X\@@@@@@@BK@XA1WA"X&Y&XE#T:P@FK@@@@@@@@# !!H
fm@2327
   223
]F$<II&YH3H>N2 H# @@@@@@@@@''GG)*Y2$9NRIDO4DQHP@@@@@@@@@@!!@EP[6U]I"UIQTL.@XP@@@@@@@@@@@ALAD-.XE]VS$(/@$0@@@@@@@@@@@@@@EDA
fm@2327
   224
FSQ!!VC@T@UD@@@@@@@@@@@@@@@@@#R,I@PDIJ84@@@@@@@@@@@@@@@@@@@@@%)^W% @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
fm@2327
   225
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@a') ; colorMapFromArray:#[0 0 0 48 54 77 55 63 87 56 64 89 57 67 90 59 67 90 64 69 89 71 74 92 72 76 96 76 81 100 80 89 118 82 90 119 83 91 120 84 92 122 86 94 123 87 96 124 89 97 126 92 104 132 97 106 136 97 110 138 97 112 138 100 102 112 101 107 130 104 118 144 105 113 135 105 124 146 107 109 118 107 116 144 110 127 148 112 126 148 113 129 148 117 119 129 118 130 156 119 123 133 125 140 174 127 131 146 127 132 148 127 146 178 130 151 181 131 132 143 133 149 185 133 152 182 134 134 138 137 140 150 138 138 142 139 156 191 141 160 195 143 164 199 143 169 198 144 157 197 144 158 197 152 173 208 153 184 209 155 167 210 156 180 208 157 179 215 157 180 211 160 162 171 160 173 216 160 174 216 160 182 214 161 173 217 161 174 217 161 176 219 161 179 220 161 180 220 163 182 222 163 184 222 164 182 222 164 184 223 166 164 161 166 189 212 166 194 211 167 190 228 167 194 229 167 200 221 169 170 174 169 195 212 169 196 232 170 181 228 170 203 221 171 171 176 171 173 182 171 193 220 173 182 232 173 192 232 173 200 234 175 206 239 175 210 240 176 188 237 178 175 168 178 175 173 178 202 234 178 206 240 179 195 238 180 205 223 180 214 243 180 216 244 181 193 242 181 195 239 181 204 223 181 212 243 182 206 242 182 209 243 184 180 173 184 211 244 184 215 245 185 198 246 185 200 244 188 215 233 188 225 249 189 226 249 190 206 250 190 219 248 191 209 249 191 217 248 191 222 248 192 188 181 192 221 249 194 190 184 195 191 184 196 226 251 196 232 251 199 196 189 202 198 191 202 226 253 203 199 193 203 229 253 203 237 252 203 237 253 204 202 196 206 202 195 206 205 204 207 203 196 208 204 197 208 205 201 212 208 200 212 208 201 212 208 202 212 209 205 213 210 202 213 212 213 214 211 206 215 212 207 216 213 206 218 215 210 220 221 223 221 219 214 222 219 215 222 220 215 230 228 225 236 235 232 243 243 244 255 255 255]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@C@@@C@@@C@G C@_8C@?<CA?>CC??CC??CG??#G??#G??#G??#C??CC??CA?>C@?<C@_8C@G C@@@C@@@C@@@C') ; yourself); yourself]
fm@2327
   226
!
fm@2327
   227
fm@2327
   228
searchPreviousIcon
fm@2327
   229
    "This resource specification was automatically generated
fm@2327
   230
     by the ImageEditor of ST/X."
fm@2327
   231
fm@2327
   232
    "Do not manually edit this!! If it is corrupted,
fm@2327
   233
     the ImageEditor may not be able to read the specification."
fm@2327
   234
fm@2327
   235
    "
fm@2327
   236
     self searchPreviousIcon inspect
fm@2327
   237
     ImageEditor openOnClass:self andSelector:#searchPreviousIcon
fm@2327
   238
     Icon flushCachedIcons
fm@2327
   239
    "
fm@2327
   240
fm@2327
   241
    <resource: #image>
fm@2327
   242
fm@2327
   243
    ^Icon
cg@2434
   244
	constantNamed:#'Psiware::SystemManagement class searchPreviousIcon'
cg@2434
   245
	ifAbsentPut:[(Depth8Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#[8]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
fm@2327
   246
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%)^W% @@@@@@@@@@@@@@
fm@2327
   247
@@@@@@BMJ0$A@P$+#P@@@@@@@@@@@@@@@@AQ@Q$4XU 0E@EQ@@@@@@@@@@@@@@ALAD-.XE]VS$(/@$0@@@@@@@@@@@BD@UA/YU4&IT%EP28A!!@@@@@@@@@@@
fm@2327
   248
I11:Z&\)NS$"QC=ADRD@@@@@@@@@# !!H]F$<II&YH3H>N2 H# @@@@@@@H,A GE\FI"Y&Y VMS)@@X,@@@@@@@BG@XE3HIJY&Y&Y$!!,=P FG@@@@@@@@  ]M
fm@2327
   249
T5JY&Y&Y&Y%RLR4G  @@@@@@@@@_G&4RC08MC@,JDC\SG0@@@@@@@@@@V0E__WA+X%%TS5T3@U,@@@@@@@@@@@@,AVQ?\&1#W&X8@20@@@@@@@@@@@@@@B(A
fm@2327
   250
GT]9]#XW@R(@@@@@@@@@@@@@@@@@Q!!(F@PDFETX@@@@@@@@@@@@@@@@@@@@@ZE)ZZ@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
fm@2327
   251
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@a') ; colorMapFromArray:#[0 0 0 48 54 77 55 63 87 56 64 89 57 67 90 59 67 90 64 69 89 71 74 92 72 76 96 76 81 100 80 89 118 82 90 119 83 91 120 84 92 122 86 94 123 87 96 124 89 97 126 92 104 132 97 106 136 97 110 138 97 112 138 100 102 112 101 107 130 104 118 144 105 113 135 105 124 146 107 109 118 107 116 144 110 127 148 112 126 148 113 129 148 117 119 129 118 130 156 119 123 133 125 140 174 127 131 146 127 132 148 127 146 178 130 151 181 131 132 143 133 149 185 133 152 182 134 134 138 137 140 150 138 138 142 139 156 191 141 160 195 143 164 199 143 169 198 144 157 197 144 158 197 152 173 208 153 184 209 155 167 210 156 180 208 157 179 215 157 180 211 160 162 171 160 173 216 160 174 216 160 182 214 161 173 217 161 174 217 161 176 219 161 179 220 161 180 220 163 182 222 163 184 222 164 182 222 164 184 223 166 164 161 166 189 212 166 194 211 167 190 228 167 194 229 167 200 221 169 170 174 169 195 212 169 196 232 170 181 228 170 203 221 171 171 176 171 173 182 171 193 220 173 182 232 173 192 232 173 200 234 175 206 239 175 210 240 176 188 237 178 175 168 178 175 173 178 202 234 178 206 240 179 195 238 180 205 223 180 214 243 180 216 244 181 193 242 181 195 239 181 204 223 181 212 243 182 206 242 182 209 243 184 180 173 184 211 244 184 215 245 185 198 246 185 200 244 188 215 233 188 225 249 189 226 249 190 206 250 190 219 248 191 209 249 191 217 248 191 222 248 192 188 181 192 221 249 194 190 184 195 191 184 196 226 251 196 232 251 199 196 189 202 198 191 202 226 253 203 199 193 203 229 253 203 237 252 203 237 253 204 202 196 206 202 195 206 205 204 207 203 196 208 204 197 208 205 201 212 208 200 212 208 201 212 208 202 212 209 205 213 210 202 213 212 213 214 211 206 215 212 207 216 213 206 218 215 210 220 221 223 221 219 214 222 219 215 222 220 215 230 228 225 236 235 232 243 243 244 255 255 255]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@C@@@C@@@C@G C@_8C@?<CA?>CC??CC??CG??#G??#G??#G??#C??CC??CA?>C@?<C@_8C@G C@@@C@@@C@@@C') ; yourself); yourself]
fm@2327
   252
!
fm@2327
   253
fm@2327
   254
searchToolBarIcon
fm@2327
   255
    "This resource specification was automatically generated
fm@2327
   256
     by the ImageEditor of ST/X."
fm@2327
   257
fm@2327
   258
    "Do not manually edit this!! If it is corrupted,
fm@2327
   259
     the ImageEditor may not be able to read the specification."
fm@2327
   260
fm@2327
   261
    "
fm@2327
   262
     self searchToolBarIcon inspect
fm@2327
   263
     ImageEditor openOnClass:self andSelector:#searchToolBarIcon
fm@2327
   264
     Icon flushCachedIcons
fm@2327
   265
    "
fm@2327
   266
fm@2327
   267
    <resource: #image>
fm@2327
   268
fm@2327
   269
    ^Icon
cg@2434
   270
	constantNamed:#'Psiware::SystemManagement class searchToolBarIcon'
cg@2434
   271
	ifAbsentPut:[(Depth24Image new) width: 22; height: 22; photometric:(#rgb); bitsPerSample:(#[8 8 8]); samplesPerPixel:(3); bits:(ByteArray fromPackedString:'
fm@2327
   272
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
fm@2327
   273
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
fm@2327
   274
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@4][>4][>@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
fm@2327
   275
@@@@@@@@@@@@@@@@@@@@@@@@@@@@;>#8/L#+!!:KS!!:KS/,'',;>''9@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@2];>^)WH
fm@2327
   276
NE:+KU*:J5&9NE6*_I#K4^S>@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@4][>RV3DLER"SWR6$K#0#;[.SGJ4L5"''UG_N4][>@@@@
fm@2327
   277
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*K''\JT*,U6Z7:^S?>/C*;.3,6>C>RFF(KEZ"3-_-@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
fm@2327
   278
@@@@@@@@@@@@&Z''HFTF &Z7">N#:7NK?7NK?6=W>!!Y''YH4N -+3T@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%I>;FDV)#ZWU??''57NK?
fm@2327
   279
7NK?:>_?\8WKFCN".K#T@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@1L;.A#V[O5")3=W;=/[4</W:1,??K$JVI4Z\7-''4@@@@@@@@@@@@
fm@2327
   280
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@7NK?-,[1E#:&C"ZZH3F U6_EU63FHS^XHS.K JOX7-''4@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@7NK?
fm@2327
   281
,K_*O5ZTCRBLPU&0FCBHDB&RDR6RH$NI Y#I4][>@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@7NK?-;#%ND&KC">BYV.*4=;>7.+>-<K!!,K/!!7NK?
fm@2327
   282
:^C;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@7NK?/K3^PT%<CBI/NE>==O;8@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
fm@2327
   283
@@@@@@@@@@@@7NK? (J9GB1SZV>W:M3?@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@5MS&++3H6M/#@@@@
fm@2327
   284
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@7NK?@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
fm@2327
   285
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
fm@2327
   286
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
fm@2327
   287
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
fm@2327
   288
@@@@@@@@@@@@@@@@') ; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@C@@@C@@@C@A C@G8C@O<C@_>C@_>C@_>C@_>C@_>C@?>CA?<CC?8CG8@CG0@CC @CA@@C@@@C@@@C@@@C@@@C') ; yourself); yourself]
fm@2327
   289
!
fm@2327
   290
fm@2327
   291
warningSearchBarIcon
fm@2327
   292
    "This resource specification was automatically generated
fm@2327
   293
     by the ImageEditor of ST/X."
fm@2327
   294
fm@2327
   295
    "Do not manually edit this!! If it is corrupted,
fm@2327
   296
     the ImageEditor may not be able to read the specification."
fm@2327
   297
fm@2327
   298
    "
fm@2327
   299
     self warningSearchBarIcon inspect
fm@2327
   300
     ImageEditor openOnClass:self andSelector:#warningSearchBarIcon
fm@2327
   301
     Icon flushCachedIcons
fm@2327
   302
    "
fm@2327
   303
fm@2327
   304
    <resource: #image>
fm@2327
   305
fm@2327
   306
    ^Icon
cg@2434
   307
	constantNamed:#'Psiware::SystemManagement class warningSearchBarIcon'
cg@2434
   308
	ifAbsentPut:[(Depth24Image new) width: 22; height: 19; photometric:(#rgb); bitsPerSample:(#[8 8 8]); samplesPerPixel:(3); bits:(ByteArray fromPackedString:'
fm@2327
   309
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@?:.+<Y"P??C\@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@>_;?@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
fm@2327
   310
@@@@?]SZ)5]X.6!! -HM2??''*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@?>39-7*B4H&G>[N+%%MJ>\#A@@@@@@@@
fm@2327
   311
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@<+R?*U1&?=CN?>W^4HJ@+FY$?>+"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
fm@2327
   312
@@@@@@@@@@@@@@@@@@@@?>G_)U!!^>Z^->,B><+"4?*^-%C8?;;Z+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@??#1-(E;.65+?<#H
fm@2327
   313
?=_T?=GP?::65W-=(EQF?>WQ@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@?\#D*VAY?;61<;"0;,C@6J^+;*"0>ZN$&CX)6(-:@@@@@@@@
fm@2327
   314
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@?>#+/7Q148E6?<"4<L&:W#(:G@@@392!!48^G9WM(%24_?=WN@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
fm@2327
   315
??C?7Y&$.E5\?;V*=<:8??K_R3X5DP@@4+R49ZZ!!7VIZ/#85)%UR??G/@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@?=7.2&)6=IJQ?;..=]W@??7*PS$7E@,N
fm@2327
   316
4<OC?>K^>(M=1S8;)$ID8Y6^@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@;HNR4U%%<)&S?<^9??_(??;3REEN@P,J2<[C??K/?:R!!/C8?&R(0(T-N?>GZ@@@@
fm@2327
   317
@@@@@@@@@@@@@@@@@@@@?<;H,31B3T9U2'')1?L3@?>3&=^7*XWE0@@<M7=;\??S3?=_U46-,#Q(!!$B,/18"A@@@@@@@@@@@@@@@@@@@@??G&1G!!*,S03)SP,
fm@2327
   318
3()?>=WL??_:<>33[G:@D2T%;^/,??#8??K19Y6^&R(0!!QPX#S8:;K22@@@@@@@@@@@@@@@@<*RZ+5I@*$D+*T48<[N&?>C_7,+U??3?7N''/(J.-?/+;??W5
fm@2327
   319
;.O!!?>G_3&]+ 0(O#B8.(U9X@@@@@@@@@@@@?<?Y/%MM.487%$P^7I)7?<&=?=+ <^W3;?C?YV]3JR .-*60=/W35.[#<>W"?:*+*3@3$R\)^R ''2)^T@@@@
fm@2327
   320
?>K2;(ZO2DQ@-SP!!,5H/?<F!!?<V=?;3B?=_"?>7:)72EUBT+<,GD?>?,<M;Z>]GO?<#J8VM& P4P_A0^ C(:?>+''?:"+34%H13L/02("13T(13\,5$H>3S<=
fm@2327
   321
1TMC0DQD/$IB/D@>.S4;-S,8,C(:,C 9-3X:(A4""@4R_1DT RH&/6%*?82D/S8503873C<85C<923H,23@+/RP\-"HX,"HW+"DX*"@V)10U)1(S)!!XU)AXU
fm@2327
   322
(Q0_$1XZ#1X["A(]^QPX&34>?;&).&-Z/6]Y06MU1&AR/5UG15-N0EYF1&EO0&EN/&EP.6AN.%5N.5-M.5%P/UYQ.$)I.4)L0UQW/U-\+5YX5XFA') ; mask:((Depth1Image new) width: 22; height: 19; photometric:(#blackIs0); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@C G@G0C@O0C@O8C@_8C@?<C@?<CA?>CC??CC??CC??#G??#O??3O??3_??;????????????????') ; yourself); yourself]
fm@2327
   323
! !
fm@2327
   324
cg@2015
   325
!InternationalLanguageTranslationEditor class methodsFor:'interface specs'!
cg@2015
   326
cg@2015
   327
windowSpec
cg@2015
   328
    "This resource specification was automatically generated
cg@2015
   329
     by the UIPainter of ST/X."
cg@2015
   330
cg@2015
   331
    "Do not manually edit this!! If it is corrupted,
cg@2015
   332
     the UIPainter may not be able to read the specification."
cg@2015
   333
cg@2015
   334
    "
cg@2048
   335
     UIPainter new openOnClass:Tools::InternationalLanguageTranslationEditor andSelector:#windowSpec
cg@2048
   336
     Tools::InternationalLanguageTranslationEditor new openInterface:#windowSpec
cg@2048
   337
     Tools::InternationalLanguageTranslationEditor open
cg@2015
   338
    "
cg@2015
   339
cg@2015
   340
    <resource: #canvas>
cg@2015
   341
sv@3245
   342
    ^ 
sv@3245
   343
    #(FullSpec
sv@3245
   344
       name: windowSpec
sv@3245
   345
       window: 
sv@3245
   346
      (WindowSpec
sv@3245
   347
         label: 'InternationalLanguageTranslationEditor'
sv@3245
   348
         name: 'InternationalLanguageTranslationEditor'
sv@3245
   349
         min: (Point 10 10)
sv@3245
   350
         bounds: (Rectangle 0 0 774 610)
sv@3245
   351
         menu: mainMenu
sv@3245
   352
       )
sv@3245
   353
       component: 
sv@3245
   354
      (SpecCollection
sv@3245
   355
         collection: (
sv@3245
   356
          (MenuPanelSpec
sv@3245
   357
             name: 'ToolBar'
sv@3245
   358
             layout: (LayoutFrame 0 0 0 0 0 1 30 0)
sv@3245
   359
             menu: menuToolBar
sv@3245
   360
             textDefault: true
sv@3245
   361
           )
sv@3245
   362
          (VariableVerticalPanelSpec
sv@3245
   363
             name: 'TranslationsVariableVerticalPanel'
sv@3245
   364
             layout: (LayoutFrame 0 0 30 0 0 1 -32 1)
sv@3245
   365
             component: 
sv@3245
   366
            (SpecCollection
sv@3245
   367
               collection: (
sv@3245
   368
                (DataSetSpec
sv@3245
   369
                   name: 'KeyStringAndLanguageSelectionTable'
sv@3245
   370
                   model: selectedKeyRow
sv@3245
   371
                   menu: keyStringAndLanguageSelectionTableMenu
sv@3245
   372
                   hasHorizontalScrollBar: true
sv@3245
   373
                   hasVerticalScrollBar: true
sv@3245
   374
                   dataList: keyStringAndLanguageSelectionTable
sv@3245
   375
                   columnHolder: keyStringAndLanguageSelectionTableColumnDescriptionHolder
sv@3245
   376
                   beDependentOfRows: true
sv@3245
   377
                   columnAdaptor: yourself
sv@3245
   378
                   postBuildCallback: postBuildDataSet:
sv@3245
   379
                 )
sv@3245
   380
                (VariableVerticalPanelSpec
sv@3245
   381
                   name: 'VariableVerticalPanel1'
sv@3245
   382
                   component: 
sv@3245
   383
                  (SpecCollection
sv@3245
   384
                     collection: (
sv@3245
   385
                      (ViewSpec
sv@3245
   386
                         name: 'Box1'
sv@3245
   387
                         component: 
sv@3245
   388
                        (SpecCollection
sv@3245
   389
                           collection: (
sv@3245
   390
                            (LabelSpec
sv@3245
   391
                               label: 'Original String (Key):'
sv@3245
   392
                               name: 'Label2'
sv@3245
   393
                               layout: (LayoutFrame 0 0 -2 0 0 1 28 0)
sv@3245
   394
                               translateLabel: true
sv@3245
   395
                               adjust: left
sv@3245
   396
                             )
sv@3245
   397
                            (TextEditorSpec
sv@3245
   398
                               name: 'OriginalText'
sv@3245
   399
                               layout: (LayoutFrame 0 0 27 0 0 1 -2 1)
sv@3245
   400
                               model: originalTextHolder
sv@3245
   401
                               hasHorizontalScrollBar: true
sv@3245
   402
                               hasVerticalScrollBar: true
sv@3245
   403
                               modifiedChannel: originalTextModifiedHolder
sv@3245
   404
                               acceptCallBack: languageTextAccepted
sv@3245
   405
                               hasKeyboardFocusInitially: false
sv@3245
   406
                             )
sv@3245
   407
                            )
sv@3245
   408
                          
sv@3245
   409
                         )
sv@3245
   410
                       )
sv@3245
   411
                      (ViewSpec
sv@3245
   412
                         name: 'Box3'
sv@3245
   413
                         component: 
sv@3245
   414
                        (SpecCollection
sv@3245
   415
                           collection: (
sv@3245
   416
                            (LabelSpec
sv@3245
   417
                               label: 'Select Another Language as example:'
sv@3245
   418
                               name: 'Label3'
sv@3245
   419
                               layout: (LayoutFrame 0 0 -6 0 0 1 24 0)
sv@3245
   420
                               translateLabel: true
sv@3245
   421
                               adjust: left
sv@3245
   422
                             )
sv@3245
   423
                            (ComboBoxSpec
sv@3245
   424
                               name: 'ComboBox1'
sv@3245
   425
                               layout: (LayoutFrame 281 0 -2 0 406 0 18 0)
sv@3245
   426
                               model: exampleLanguageSelectionHolder
sv@3245
   427
                               immediateAccept: false
sv@3245
   428
                               acceptOnLeave: true
sv@3245
   429
                               acceptOnLostFocus: true
sv@3245
   430
                               acceptOnPointerLeave: false
sv@3245
   431
                               comboList: shownLanguages
sv@3245
   432
                               useIndex: false
sv@3245
   433
                             )
sv@3245
   434
                            (TextEditorSpec
sv@3245
   435
                               name: 'ExampleLanguageText'
sv@3245
   436
                               layout: (LayoutFrame 0 0 30 0 0 1 0 1)
sv@3245
   437
                               model: exampleLanguageTextHolder
sv@3245
   438
                               hasHorizontalScrollBar: true
sv@3245
   439
                               hasVerticalScrollBar: true
sv@3245
   440
                               isReadOnly: true
sv@3245
   441
                               hasKeyboardFocusInitially: false
sv@3245
   442
                             )
sv@3245
   443
                            )
sv@3245
   444
                          
sv@3245
   445
                         )
sv@3245
   446
                       )
sv@3245
   447
                      (ViewSpec
sv@3245
   448
                         name: 'Box2'
sv@3245
   449
                         component: 
sv@3245
   450
                        (SpecCollection
sv@3245
   451
                           collection: (
sv@3245
   452
                            (LabelSpec
sv@3245
   453
                               label: 'Translated String:'
sv@3245
   454
                               name: 'Label1'
sv@3245
   455
                               layout: (LayoutFrame 0 0 0 0 0 1 30 0)
sv@3245
   456
                               translateLabel: true
sv@3245
   457
                               adjust: left
sv@3245
   458
                             )
sv@3245
   459
                            (TextEditorSpec
sv@3245
   460
                               name: 'LanguageText'
sv@3245
   461
                               layout: (LayoutFrame 0 0 30 0 0 1 0 1)
sv@3245
   462
                               model: languageTextHolder
sv@3245
   463
                               hasHorizontalScrollBar: true
sv@3245
   464
                               hasVerticalScrollBar: true
sv@3245
   465
                               acceptChannel: languageTextAcceptHolder
sv@3245
   466
                               modifiedChannel: languageTextModifiedHolder
sv@3245
   467
                               acceptCallBack: languageTextAccepted
sv@3245
   468
                               hasKeyboardFocusInitially: false
sv@3245
   469
                               postBuildCallback: languageEditorBuilt:
sv@3245
   470
                             )
sv@3245
   471
                            (ActionButtonSpec
sv@3245
   472
                               label: 'Paste Previous'
sv@3245
   473
                               name: 'pastePreviousTranslation'
sv@3245
   474
                               layout: (LayoutOrigin 0 0.83085250338295003 0 0.034482758620689995)
sv@3245
   475
                               translateLabel: true
sv@3245
   476
                               model: pastePreviousTranslationInLanguageText
sv@3245
   477
                               enableChannel: pastePreviousTranslationEnableHolder
sv@3245
   478
                               disabledLogo: 'Paste Previous'
sv@3245
   479
                             )
sv@3245
   480
                            (ActionButtonSpec
sv@3245
   481
                               label: 'Paste Original'
sv@3245
   482
                               name: 'Button1'
sv@3245
   483
                               layout: (LayoutOrigin -95 0.83085250338295003 0 0.034482758620689995)
sv@3245
   484
                               translateLabel: true
sv@3245
   485
                               model: pasteOriginalInLanguageText
sv@3245
   486
                               enableChannel: pasteOriginalEnableHolder
sv@3245
   487
                               disabledLogo: 'Paste Original'
sv@3245
   488
                             )
sv@3245
   489
                            )
sv@3245
   490
                          
sv@3245
   491
                         )
sv@3245
   492
                       )
sv@3245
   493
                      )
sv@3245
   494
                    
sv@3245
   495
                   )
cg@3286
   496
                   handles: (Any 0.3333333333333301 0.66666666666667018 1.0)
sv@3245
   497
                 )
sv@3245
   498
                )
sv@3245
   499
              
sv@3245
   500
             )
sv@3245
   501
             handles: (Any 0.5 1.0)
sv@3245
   502
             postBuildCallback: postBuildTranslationsPanel:
sv@3245
   503
           )
sv@3245
   504
          (ViewSpec
sv@3245
   505
             name: 'SearchBox'
sv@3245
   506
             layout: (LayoutFrame 0 0 -32 1 0 1 0 1)
sv@3245
   507
             level: -1
sv@3245
   508
             visibilityChannel: searchBoxVisible
sv@3245
   509
             component: 
sv@3245
   510
            (SpecCollection
sv@3245
   511
               collection: (
sv@3245
   512
                (ActionButtonSpec
sv@3245
   513
                   label: 'closeSearchBarIcon'
sv@3245
   514
                   name: 'closeSearchBarButton'
sv@3245
   515
                   layout: (LayoutFrame 4 0 5 0 25 0 26 0)
sv@3245
   516
                   hasCharacterOrientedLabel: false
sv@3245
   517
                   translateLabel: true
sv@3245
   518
                   model: closeSearchBar
sv@3245
   519
                 )
sv@3245
   520
                (LabelSpec
sv@3245
   521
                   label: 'Search:'
sv@3245
   522
                   name: 'SearchLabel'
cg@3286
   523
                   layout: (LayoutFrame 30 0 5 0 100 0 27 0)
sv@3245
   524
                   translateLabel: true
sv@3245
   525
                   adjust: right
sv@3245
   526
                 )
sv@3245
   527
                (InputFieldSpec
sv@3245
   528
                   name: 'SearchEntryField'
cg@3286
   529
                   layout: (LayoutFrame 100 0 5 0 257 0 27 0)
sv@3245
   530
                   model: searchTextHolder
sv@3245
   531
                   immediateAccept: true
sv@3245
   532
                   acceptOnReturn: true
sv@3245
   533
                   acceptOnTab: true
sv@3245
   534
                   acceptOnLostFocus: true
sv@3245
   535
                   modifiedChannel: searchTextModifiedHolder
sv@3245
   536
                   acceptOnPointerLeave: false
sv@3245
   537
                   postBuildCallback: postBuildSearchTextView:
sv@3245
   538
                 )
sv@3245
   539
                (ActionButtonSpec
sv@3245
   540
                   label: 'searchNextIcon'
sv@3245
   541
                   name: 'SearchNextButton'
cg@3286
   542
                   layout: (LayoutFrame 264 0 5 0 285 0 26 0)
sv@3245
   543
                   hasCharacterOrientedLabel: false
sv@3245
   544
                   translateLabel: true
sv@3245
   545
                   model: searchNextText
sv@3245
   546
                 )
sv@3245
   547
                (ActionButtonSpec
sv@3245
   548
                   label: 'searchPreviousIcon'
sv@3245
   549
                   name: 'searchPreviousButton'
cg@3286
   550
                   layout: (LayoutFrame 292 0 5 0 313 0 26 0)
sv@3245
   551
                   hasCharacterOrientedLabel: false
sv@3245
   552
                   translateLabel: true
sv@3245
   553
                   model: searchPreviousText
sv@3245
   554
                 )
sv@3245
   555
                (CheckBoxSpec
sv@3245
   556
                   label: 'Ignore case'
sv@3245
   557
                   name: 'IgnoreCaseCheckBox'
cg@3286
   558
                   layout: (LayoutFrame 322 0 5 0 518 0 27 0)
sv@3245
   559
                   model: ignoreCaseHolder
sv@3245
   560
                   translateLabel: true
sv@3245
   561
                 )
sv@3245
   562
                (LabelSpec
sv@3245
   563
                   label: 'SearchBarImageInfoLabel'
sv@3245
   564
                   name: 'SearchBarImageInfoLabel'
cg@3286
   565
                   layout: (LayoutFrame 524 0 5 0 548 0 27 0)
sv@3245
   566
                   hasCharacterOrientedLabel: false
sv@3245
   567
                   translateLabel: true
sv@3245
   568
                   labelChannel: searchBarImageInfoLabelHolder
sv@3245
   569
                 )
sv@3245
   570
                (LabelSpec
sv@3245
   571
                   label: 'SearchBarInfoLabel'
sv@3245
   572
                   name: 'SearchBarInfoLabel'
cg@3286
   573
                   layout: (LayoutFrame 551 0 5 0 829 0 27 0)
sv@3245
   574
                   translateLabel: true
sv@3245
   575
                   labelChannel: searchBarInfoLabelHolder
sv@3245
   576
                   adjust: left
sv@3245
   577
                 )
sv@3245
   578
                )
sv@3245
   579
              
sv@3245
   580
             )
sv@3245
   581
             postBuildCallback: postBuildSearchBoxView:
sv@3245
   582
           )
sv@3245
   583
          )
sv@3245
   584
        
sv@3245
   585
       )
sv@3245
   586
     )
cg@2015
   587
! !
cg@2015
   588
cg@2015
   589
!InternationalLanguageTranslationEditor class methodsFor:'menu specs'!
cg@2015
   590
fm@2163
   591
keyStringAndLanguageSelectionTableMenu
fm@2163
   592
    "This resource specification was automatically generated
fm@2163
   593
     by the MenuEditor of ST/X."
fm@2163
   594
fm@2163
   595
    "Do not manually edit this!! If it is corrupted,
fm@2163
   596
     the MenuEditor may not be able to read the specification."
fm@2163
   597
mawalch@3448
   598
fm@2163
   599
    "
fm@2163
   600
     MenuEditor new openOnClass:Tools::InternationalLanguageTranslationEditor andSelector:#keyStringAndLanguageSelectionTableMenu
fm@2163
   601
     (Menu new fromLiteralArrayEncoding:(Tools::InternationalLanguageTranslationEditor keyStringAndLanguageSelectionTableMenu)) startUp
fm@2163
   602
    "
fm@2163
   603
fm@2163
   604
    <resource: #menu>
fm@2163
   605
mawalch@3448
   606
    ^ 
fm@2163
   607
     #(Menu
cg@3286
   608
        (
cg@3286
   609
         (MenuItem
cg@3286
   610
            label: 'Browse Methods Containing this String'
cg@3286
   611
            itemValue: browseReferringMethods
cg@3286
   612
          )
cg@3286
   613
         (MenuItem
cg@3286
   614
            label: '-'
cg@3286
   615
          )
cg@3286
   616
         (MenuItem
cg@3286
   617
            label: 'Set Current NameSpace...'
cg@3286
   618
            itemValue: changeLastNameSpace
cg@3286
   619
          )
cg@3286
   620
         (MenuItem
cg@3286
   621
            label: 'Search String in Current NameSpace'
cg@3286
   622
            itemValue: searchStringInLastNameSpace
cg@3286
   623
          )
cg@3286
   624
         (MenuItem
cg@3286
   625
            label: '-'
mawalch@3448
   626
            isVisible: false
cg@3286
   627
          )
cg@3286
   628
         (MenuItem
cg@3286
   629
            label: 'Set Current Package...'
cg@3286
   630
            itemValue: changeLastPackage
mawalch@3448
   631
            isVisible: false
cg@3286
   632
          )
cg@3286
   633
         (MenuItem
cg@3286
   634
            label: 'Search String in Current Package'
cg@3286
   635
            itemValue: searchStringInLastPackage
mawalch@3448
   636
            isVisible: false
cg@3286
   637
          )
cg@3286
   638
         )
cg@3286
   639
        nil
cg@3286
   640
        nil
fm@2163
   641
      )
fm@2163
   642
!
fm@2163
   643
cg@2015
   644
mainMenu
cg@2015
   645
    "This resource specification was automatically generated
cg@2015
   646
     by the MenuEditor of ST/X."
cg@2015
   647
cg@2015
   648
    "Do not manually edit this!! If it is corrupted,
cg@2015
   649
     the MenuEditor may not be able to read the specification."
cg@2015
   650
jan@3189
   651
cg@2015
   652
    "
fm@2050
   653
     MenuEditor new openOnClass:Tools::InternationalLanguageTranslationEditor andSelector:#mainMenu
fm@2050
   654
     (Menu new fromLiteralArrayEncoding:(Tools::InternationalLanguageTranslationEditor mainMenu)) startUp
cg@2015
   655
    "
cg@2015
   656
cg@2015
   657
    <resource: #menu>
cg@2015
   658
jan@3189
   659
    ^ 
cg@2015
   660
     #(Menu
jan@3189
   661
        (
jan@3189
   662
         (MenuItem
jan@3189
   663
            label: 'File'
jan@3189
   664
            submenu: 
jan@3189
   665
           (Menu
jan@3189
   666
              (
jan@3189
   667
               (MenuItem
jan@3189
   668
                  label: 'New'
jan@3189
   669
                  itemValue: menuNew
jan@3189
   670
                )
jan@3189
   671
               (MenuItem
jan@3189
   672
                  label: '-'
jan@3189
   673
                )
jan@3189
   674
               (MenuItem
jan@3189
   675
                  label: 'Open Resources for Package or Project...'
jan@3189
   676
                  itemValue: menuOpenByPackage
jan@3189
   677
                )
jan@3189
   678
               (MenuItem
jan@3189
   679
                  label: 'Open Resource File...'
jan@3189
   680
                  itemValue: menuOpen
jan@3189
   681
                )
jan@3189
   682
               (MenuItem
jan@3189
   683
                  label: '-'
jan@3189
   684
                )
jan@3189
   685
               (MenuItem
jan@3189
   686
                  label: 'Save All Resource Files'
jan@3189
   687
                  itemValue: menuSaveAll
jan@3189
   688
                )
jan@3189
   689
               (MenuItem
jan@3189
   690
                  label: 'Save Resource File'
jan@3189
   691
                  itemValue: menuSave
jan@3189
   692
                )
jan@3189
   693
               (MenuItem
jan@3189
   694
                  label: 'Save Resource File As...'
jan@3189
   695
                  itemValue: menuSaveAs
jan@3189
   696
                )
jan@3189
   697
               (MenuItem
jan@3189
   698
                  label: '-'
jan@3189
   699
                )
jan@3189
   700
               (MenuItem
jan@3189
   701
                  label: 'Import existing translations from file...'
jan@3189
   702
                  itemValue: importExistingTranslationsFromFile
jan@3189
   703
                )
jan@3189
   704
               (MenuItem
jan@3189
   705
                  label: '-'
jan@3189
   706
                )
jan@3189
   707
               (MenuItem
jan@3189
   708
                  label: 'Set Current NameSpace'
jan@3189
   709
                  itemValue: changeLastNameSpace
jan@3189
   710
                )
jan@3189
   711
               (MenuItem
jan@3189
   712
                  label: 'Set Current Package'
jan@3189
   713
                  itemValue: changeLastPackage
mawalch@3447
   714
                  isVisible: false
jan@3189
   715
                )
jan@3189
   716
               (MenuItem
jan@3189
   717
                  label: '-'
jan@3189
   718
                )
jan@3189
   719
               (MenuItem
jan@3189
   720
                  label: 'Exit'
jan@3189
   721
                  itemValue: closeRequest
jan@3189
   722
                )
jan@3189
   723
               )
jan@3189
   724
              nil
jan@3189
   725
              nil
jan@3189
   726
            )
jan@3189
   727
          )
jan@3189
   728
         (MenuItem
jan@3189
   729
            label: 'View'
jan@3189
   730
            submenu: 
jan@3189
   731
           (Menu
jan@3189
   732
              (
jan@3189
   733
               (MenuItem
jan@3189
   734
                  label: 'Show Missing Translations Only'
jan@3189
   735
                  indication: showMissingTranslationsOnly
jan@3189
   736
                )
jan@3189
   737
               (MenuItem
cg@3286
   738
                  label: 'Show Search Box'
cg@3286
   739
                  indication: searchBoxVisible
cg@3286
   740
                )
cg@3286
   741
               (MenuItem
jan@3189
   742
                  label: '-'
jan@3189
   743
                )
jan@3189
   744
               (MenuItem
jan@3189
   745
                  label: 'Shown Languages'
jan@3189
   746
                  submenuChannel: shownLanguagesMenu
jan@3189
   747
                )
jan@3189
   748
               )
jan@3189
   749
              nil
jan@3189
   750
              nil
jan@3189
   751
            )
jan@3189
   752
          )
jan@3189
   753
         (MenuItem
jan@3189
   754
            label: 'Languages'
jan@3189
   755
            submenu: 
jan@3189
   756
           (Menu
jan@3189
   757
              (
jan@3189
   758
               (MenuItem
jan@3189
   759
                  label: 'Add Language...'
jan@3189
   760
                  itemValue: addLanguage
jan@3189
   761
                )
jan@3189
   762
               (MenuItem
jan@3189
   763
                  label: 'Remove Language...'
jan@3189
   764
                  itemValue: removeLanguage
jan@3189
   765
                )
jan@3189
   766
               )
jan@3189
   767
              nil
jan@3189
   768
              nil
jan@3189
   769
            )
jan@3189
   770
          )
jan@3189
   771
         (MenuItem
jan@3189
   772
            label: 'Translations'
jan@3189
   773
            submenuChannel: translationsMenuSpec
jan@3189
   774
          )
jan@3189
   775
         (MenuItem
jan@3189
   776
            label: 'Preferences'
jan@3189
   777
            submenu: 
jan@3189
   778
           (Menu
jan@3189
   779
              (
jan@3189
   780
               (MenuItem
jan@3189
   781
                  label: 'Auto Accept Changes'
jan@3189
   782
                  indication: autoAcceptHolder
jan@3189
   783
                )
jan@3189
   784
               (MenuItem
jan@3189
   785
                  label: 'Search For Similar Translations'
jan@3189
   786
                  indication: searchForSimilarTranslationEnableHolder
jan@3189
   787
                )
jan@3189
   788
               (MenuItem
jan@3189
   789
                  label: 'Always Write UTF8'
jan@3189
   790
                  indication: alwaysWriteUTF8Holder
jan@3189
   791
                )
jan@3189
   792
               )
jan@3189
   793
              nil
jan@3189
   794
              nil
jan@3189
   795
            )
jan@3189
   796
          )
jan@3189
   797
         (MenuItem
jan@3189
   798
            label: 'Help'
jan@3189
   799
            startGroup: right
jan@3189
   800
            submenu: 
jan@3189
   801
           (Menu
jan@3189
   802
              (
jan@3189
   803
               (MenuItem
jan@3189
   804
                  label: 'Documentation'
jan@3189
   805
                  itemValue: openDocumentation
jan@3189
   806
                )
jan@3189
   807
               (MenuItem
jan@3189
   808
                  label: '-'
jan@3189
   809
                )
jan@3189
   810
               (MenuItem
jan@3189
   811
                  label: 'About this Application...'
jan@3189
   812
                  itemValue: openAboutThisApplication
jan@3189
   813
                )
jan@3189
   814
               )
jan@3189
   815
              nil
jan@3189
   816
              nil
jan@3189
   817
            )
jan@3189
   818
          )
jan@3189
   819
         )
jan@3189
   820
        nil
jan@3189
   821
        nil
cg@2015
   822
      )
cg@2015
   823
!
cg@2015
   824
fm@2051
   825
menuItemsEditLanguage
fm@2051
   826
    "This resource specification was automatically generated
fm@2051
   827
     by the MenuEditor of ST/X."
fm@2051
   828
fm@2051
   829
    "Do not manually edit this!! If it is corrupted,
fm@2051
   830
     the MenuEditor may not be able to read the specification."
fm@2051
   831
fm@2051
   832
    "
fm@2051
   833
     MenuEditor new openOnClass:Tools::InternationalLanguageTranslationEditor andSelector:#menu
fm@2051
   834
     (Menu new fromLiteralArrayEncoding:(Tools::InternationalLanguageTranslationEditor menu)) startUp
fm@2051
   835
    "
fm@2051
   836
fm@2051
   837
    <resource: #menu>
fm@2051
   838
cg@2434
   839
    ^
fm@2051
   840
     #(Menu
cg@2434
   841
	(
cg@2434
   842
	 (MenuItem
cg@2434
   843
	    enabled: pastePreviousTranslationEnableHolder
cg@2434
   844
	    label: 'Paste Previous Translation'
cg@2434
   845
	    itemValue: pastePreviousTranslationInLanguageText
cg@2434
   846
	    nameKey: pastePreviousTranslationInLanguageText
cg@2434
   847
	    translateLabel: true
cg@2434
   848
	  )
cg@2434
   849
	 )
cg@2434
   850
	nil
cg@2434
   851
	nil
fm@2051
   852
      )
fm@2051
   853
!
fm@2051
   854
cg@2015
   855
menuToolBar
cg@2015
   856
    "This resource specification was automatically generated
cg@2015
   857
     by the MenuEditor of ST/X."
cg@2015
   858
cg@2015
   859
    "Do not manually edit this!! If it is corrupted,
cg@2015
   860
     the MenuEditor may not be able to read the specification."
cg@2015
   861
cg@2880
   862
cg@2015
   863
    "
fm@2051
   864
     MenuEditor new openOnClass:Tools::InternationalLanguageTranslationEditor andSelector:#menuToolBar
fm@2051
   865
     (Menu new fromLiteralArrayEncoding:(Tools::InternationalLanguageTranslationEditor menuToolBar)) startUp
cg@2015
   866
    "
cg@2015
   867
cg@2015
   868
    <resource: #menu>
cg@2015
   869
cg@2880
   870
    ^ 
cg@2015
   871
     #(Menu
cg@2880
   872
        (
cg@2880
   873
         (MenuItem
cg@2880
   874
            label: 'Save'
cg@2880
   875
            itemValue: menuSave
cg@2880
   876
            isButton: true
cg@2880
   877
            labelImage: (ResourceRetriever XPToolbarIconLibrary saveImageIcon)
cg@2880
   878
          )
cg@2880
   879
         (MenuItem
cg@2880
   880
            label: '-'
cg@2880
   881
          )
cg@2880
   882
         (MenuItem
cg@2880
   883
            label: 'Add Translation'
cg@2880
   884
            itemValue: addTranslation
cg@2880
   885
            isButton: true
cg@2880
   886
            labelImage: (ResourceRetriever XPToolbarIconLibrary newRowIcon)
cg@2880
   887
          )
cg@2880
   888
         (MenuItem
cg@2880
   889
            label: 'Remove Translation'
cg@2880
   890
            itemValue: removeTranslation
cg@2880
   891
            isButton: true
cg@2880
   892
            labelImage: (ResourceRetriever XPToolbarIconLibrary removeRowIcon)
cg@2880
   893
          )
cg@2880
   894
         (MenuItem
cg@2880
   895
            label: '-'
cg@2880
   896
          )
cg@2880
   897
         (MenuItem
cg@3286
   898
            activeHelpKey: browseReferringMethods
cg@3286
   899
            label: 'Browse'
cg@3286
   900
            itemValue: browseReferringMethods
cg@3286
   901
            labelImage: (ResourceRetriever ToolbarIconLibrary systemBrowserIcon)
cg@2880
   902
          )
cg@2880
   903
         (MenuItem
cg@2880
   904
            label: ''
cg@2880
   905
          )
cg@2880
   906
         (MenuItem
cg@2880
   907
            label: 'Stop Application'
cg@2880
   908
            itemValue: stopApplication
cg@2880
   909
            isButton: true
cg@2880
   910
            isVisible: stopApplicationIconVisibleHolder
cg@2880
   911
            labelImage: (ResourceRetriever XPToolbarIconLibrary stop16x16Icon)
cg@2880
   912
          )
cg@3286
   913
         (MenuItem
cg@3286
   914
            activeHelpKey: searchBox
cg@3286
   915
            label: 'Search'
cg@3286
   916
            isButton: true
cg@3286
   917
            startGroup: right
cg@3286
   918
            hideMenuOnActivated: false
cg@3286
   919
            indication: searchBoxVisible
cg@3286
   920
            shortcutKey: Ctrlf
cg@3286
   921
            labelImage: (ResourceRetriever #'Tools::InternationalLanguageTranslationEditor' searchToolBarIcon)
cg@3286
   922
          )
cg@2880
   923
         )
cg@2880
   924
        nil
cg@2880
   925
        nil
cg@2015
   926
      )
jan@3189
   927
!
jan@3189
   928
jan@3189
   929
translationsMenuSpec
jan@3189
   930
    "This resource specification was automatically generated
jan@3189
   931
     by the MenuEditor of ST/X."
jan@3189
   932
jan@3189
   933
    "Do not manually edit this!! If it is corrupted,
jan@3189
   934
     the MenuEditor may not be able to read the specification."
jan@3189
   935
jan@3189
   936
jan@3189
   937
    "
jan@3189
   938
     MenuEditor new openOnClass:Tools::InternationalLanguageTranslationEditor andSelector:#translationsMenuSpec
jan@3189
   939
     (Menu new fromLiteralArrayEncoding:(Tools::InternationalLanguageTranslationEditor translationsMenuSpec)) startUp
jan@3189
   940
    "
jan@3189
   941
jan@3189
   942
    <resource: #menu>
jan@3189
   943
jan@3189
   944
    ^ 
jan@3189
   945
     #(Menu
jan@3189
   946
        (
jan@3189
   947
         (MenuItem
jan@3189
   948
            label: 'Add Translation...'
jan@3189
   949
            itemValue: addTranslation
jan@3189
   950
          )
jan@3189
   951
         (MenuItem
jan@3189
   952
            label: 'Remove Translation...'
jan@3189
   953
            itemValue: removeTranslation
jan@3189
   954
          )
jan@3189
   955
         (MenuItem
jan@3189
   956
            label: '-'
jan@3189
   957
          )
jan@3189
   958
         (MenuItem
cg@3286
   959
            label: 'Extract from Package...'
cg@3286
   960
            itemValue: extractTranslationsFromProject
cg@3286
   961
          )
cg@3286
   962
         (MenuItem
jan@3189
   963
            label: 'Extract from Class...'
jan@3189
   964
            itemValue: extractTranslationsFromClass
jan@3189
   965
          )
jan@3189
   966
         (MenuItem
jan@3189
   967
            label: 'Extract from NameSpace...'
jan@3189
   968
            itemValue: extractTranslationsFromNameSpace
jan@3189
   969
          )
jan@3189
   970
         (MenuItem
jan@3189
   971
            label: '-'
jan@3189
   972
          )
jan@3189
   973
         (MenuItem
jan@3189
   974
            label: 'Run Application and Collect Translations...'
jan@3189
   975
            itemValue: runApplicationAndCollectTranslations
jan@3189
   976
          )
jan@3189
   977
         (MenuItem
jan@3189
   978
            label: '-'
jan@3189
   979
          )
jan@3189
   980
         (MenuItem
jan@3189
   981
            label: 'Generate Missing Translations'
jan@3189
   982
            itemValue: generateMissingTranslations
jan@3189
   983
          )
jan@3189
   984
         (MenuItem
jan@3189
   985
            label: 'Generate Missing Translations Slice'
jan@3189
   986
            submenuChannel: menuSliceTranslateGenerate
jan@3189
   987
            isMenuSlice: true
jan@3189
   988
          )
jan@3189
   989
         )
jan@3189
   990
        nil
jan@3189
   991
        nil
jan@3189
   992
      )
cg@2015
   993
! !
cg@2015
   994
cg@2433
   995
!InternationalLanguageTranslationEditor class methodsFor:'startup'!
cg@2433
   996
cg@2433
   997
openOnFile:aFilename
cg@2433
   998
    |fn|
cg@2433
   999
cg@2433
  1000
    fn := aFilename asFilename.
cg@2433
  1001
cg@3077
  1002
    ^ self new
cg@3077
  1003
        allButOpen;
cg@3077
  1004
        readResourceFile:fn asLanguage:fn withoutSuffix baseName;
cg@3077
  1005
        openWindow;
cg@3077
  1006
        yourself.
cg@3077
  1007
!
cg@3077
  1008
cg@3077
  1009
openOnPackage:aPackageId
cg@3077
  1010
    ^ self new
cg@3077
  1011
        allButOpen;
cg@3077
  1012
        readResourceFileForPackage:aPackageId;
cg@3077
  1013
        openWindow;
cg@3077
  1014
        yourself.
cg@2433
  1015
! !
cg@2433
  1016
cg@2047
  1017
!InternationalLanguageTranslationEditor class methodsFor:'tableColumns specs'!
cg@2047
  1018
cg@2047
  1019
keyTableColumn
cg@2047
  1020
    "This resource specification was automatically generated
cg@2047
  1021
     by the DataSetBuilder of ST/X."
cg@2047
  1022
cg@2047
  1023
    "Do not manually edit this!! If it is corrupted,
cg@2047
  1024
     the DataSetBuilder may not be able to read the specification."
cg@2047
  1025
cg@2047
  1026
    "
cg@2047
  1027
     DataSetBuilder new openOnClass:Tools::InternationalLanguageTranslationEditor andSelector:#keyTableColumn
cg@2047
  1028
    "
cg@2047
  1029
cg@2047
  1030
    <resource: #tableColumns>
cg@2047
  1031
cg@2047
  1032
    ^#(
cg@2047
  1033
      (DataSetColumnSpec
cg@2434
  1034
	 label: 'Key'
cg@2434
  1035
	 labelButtonType: Button
cg@2434
  1036
	 minWidth: 50
cg@2434
  1037
	 model: keyStringInRow:
cg@2047
  1038
       )
cg@2047
  1039
      )
cg@2047
  1040
!
cg@2047
  1041
cg@2047
  1042
languageTableColumn
cg@2047
  1043
    "This resource specification was automatically generated
cg@2047
  1044
     by the DataSetBuilder of ST/X."
cg@2047
  1045
cg@2047
  1046
    "Do not manually edit this!! If it is corrupted,
cg@2047
  1047
     the DataSetBuilder may not be able to read the specification."
cg@2047
  1048
cg@2047
  1049
    "
fm@2049
  1050
     DataSetBuilder new openOnClass:Tools::InternationalLanguageTranslationEditor andSelector:#languageTableColumn
cg@2047
  1051
    "
cg@2047
  1052
cg@2047
  1053
    <resource: #tableColumns>
cg@2047
  1054
cg@2047
  1055
    ^#(
fm@2049
  1056
      (DataSetColumnSpec
cg@2434
  1057
	 label: lang
cg@2434
  1058
	 labelButtonType: Button
cg@2434
  1059
	 minWidth: 50
cg@2434
  1060
	 editorType: None
cg@2434
  1061
	 model: columnInRow:at:
cg@2434
  1062
	 backgroundSelector: getBackgroundForRow:rowNr:col:
fm@2049
  1063
       )
fm@2049
  1064
      )
fm@2049
  1065
! !
cg@2047
  1066
fm@2049
  1067
!InternationalLanguageTranslationEditor methodsFor:'accessing'!
fm@2049
  1068
cg@2434
  1069
currentSelectionIndex
fm@2327
  1070
fm@2327
  1071
    ^ self selectedKeyRow value
fm@2327
  1072
fm@2327
  1073
    "Created: / 16-06-2007 / 09:04:11 / Administrador"
fm@2327
  1074
    "Modified: / 19-06-2007 / 17:28:38 / Administrador"
fm@2327
  1075
!
fm@2327
  1076
fm@2327
  1077
exists: anObject
fm@2327
  1078
fm@2327
  1079
    ^self objectsList includes: anObject
fm@2327
  1080
fm@2327
  1081
    "Created: / 19-06-2007 / 16:42:22 / Administrador"
fm@2327
  1082
!
fm@2327
  1083
fm@2327
  1084
indexOf: anObject
fm@2327
  1085
fm@2327
  1086
    ^self objectsList indexOf: anObject
fm@2327
  1087
fm@2327
  1088
    "Created: / 19-06-2007 / 16:39:44 / Administrador"
fm@2327
  1089
!
fm@2327
  1090
fm@2049
  1091
newLanguageText
fm@2049
  1092
"/   languageEditor accept
sv@3245
  1093
    ^self languageTextHolder value isEmptyOrNil
sv@3245
  1094
        ifTrue:['']
sv@3245
  1095
        ifFalse:[self languageTextHolder value asCollectionOfLines first.]
fm@2050
  1096
!
fm@2050
  1097
fm@2327
  1098
objectsList
fm@2327
  1099
cg@2434
  1100
    ^ keyStringsToLanguageMappings
fm@2327
  1101
!
fm@2327
  1102
fm@2327
  1103
selectListIndex: rowIndex
fm@2327
  1104
"/    |selection list|
fm@2327
  1105
"/    list := self objectsList.
fm@2327
  1106
"/    list isEmpty ifTrue:[^self].
fm@2327
  1107
"/    selection := list at:rowIndex ifAbsent:nil.
fm@2327
  1108
    self selectedKeyRow value: rowIndex.
fm@2327
  1109
fm@2327
  1110
    "Created: / 16-06-2007 / 09:06:46 / Administrador"
fm@2327
  1111
    "Modified: / 22-06-2007 / 13:45:54 / Administrador"
fm@2327
  1112
!
fm@2327
  1113
cg@2434
  1114
selectedKey
fm@2050
  1115
   "Returns the current selected key if there is one row seleted. Otherwise, returns nil"
fm@2050
  1116
     |rowSelectionIndex |
fm@2050
  1117
fm@2163
  1118
    keyStringsToLanguageMappings isNil ifTrue:[^nil].
fm@2163
  1119
    self selectedKeyRow value isNil ifTrue:[^nil].
fm@2050
  1120
    rowSelectionIndex := self selectedKeyRow value.
fm@2050
  1121
    rowSelectionIndex == 0 ifTrue:[^nil].
fm@2050
  1122
    ^ keyStringsToLanguageMappings keyAt:rowSelectionIndex.
fm@2327
  1123
!
fm@2327
  1124
fm@2327
  1125
tableView
fm@2327
  1126
fm@2327
  1127
    ^dataSetView scrolledView
fm@2327
  1128
fm@2327
  1129
    "Created: / 15-06-2007 / 18:59:51 / Administrador"
cg@2047
  1130
! !
cg@2047
  1131
fm@2051
  1132
!InternationalLanguageTranslationEditor methodsFor:'additionalFuncionalities'!
fm@2051
  1133
fm@2051
  1134
searchForSimilarTranslation
fm@2163
  1135
    "Looks for a quite similar translation for the key and display a dialog with available options"
fm@2327
  1136
    |similarTranslationsAssociations selectedTranslation key|
fm@2051
  1137
cg@2434
  1138
    self shouldSearchForSimilarTranslation ifFalse:[^self].
fm@2051
  1139
fm@2327
  1140
    key := self selectedKey.
fm@2327
  1141
    key isNil ifTrue:[^ self.].
fm@2327
  1142
    similarTranslationsAssociations := keyStringsToLanguageMappings searchForSimilarTranslation: key in: self currentLanguage.
cg@2434
  1143
    similarTranslationsAssociations isEmpty ifTrue:[^self].
fm@2051
  1144
fm@2163
  1145
    similarTranslationsAssociations := similarTranslationsAssociations associations inject: OrderedCollection new into:[:collection :association |
cg@2434
  1146
	collection detect:[:selectedAssociation |
cg@2434
  1147
	    selectedAssociation value sameAs: association value] ifNone:[collection add: association].
cg@2434
  1148
	collection].
cg@2434
  1149
    selectedTranslation := Dialog
mawalch@3454
  1150
	choose:'Choose one if you consider it´s usefull to translate:
cg@2434
  1151
    ',
cg@2434
  1152
	'<', key, '>  ', (self currentExampleLanguageText ifNil:[''])
cg@2434
  1153
	fromList: (similarTranslationsAssociations collect:[:each |  '<', each key, '>  ', each value])
cg@2434
  1154
	values: (similarTranslationsAssociations collect:[:each | each value])
cg@2434
  1155
	lines:10
cg@2434
  1156
	cancel: nil.
cg@2434
  1157
cg@2434
  1158
    selectedTranslation notNil ifTrue:[self languageTextHolderValue: selectedTranslation].
fm@2051
  1159
! !
fm@2051
  1160
cg@2015
  1161
!InternationalLanguageTranslationEditor methodsFor:'aspects'!
cg@2015
  1162
fm@2053
  1163
alwaysWriteUTF8Holder
cg@2434
  1164
    alwaysWriteUTF8Holder isNil ifTrue:[alwaysWriteUTF8Holder := true asValue].
fm@2053
  1165
    ^ alwaysWriteUTF8Holder
fm@2053
  1166
!
fm@2053
  1167
fm@2050
  1168
autoAcceptHolder
cg@2434
  1169
    autoAcceptHolder isNil ifTrue:[autoAcceptHolder := true asValue].
fm@2050
  1170
    ^ autoAcceptHolder
fm@2050
  1171
!
fm@2050
  1172
fm@2050
  1173
exampleLanguageSelectionHolder
fm@2050
  1174
    exampleLanguageSelectionHolder isNil ifTrue:[
cg@2434
  1175
	exampleLanguageSelectionHolder := self exampleLanguageByDefault asValue.
cg@2434
  1176
	exampleLanguageSelectionHolder addDependent:self.
cg@2434
  1177
    ].
fm@2050
  1178
    ^ exampleLanguageSelectionHolder
fm@2050
  1179
!
fm@2050
  1180
fm@2050
  1181
exampleLanguageTextHolder
fm@2050
  1182
    exampleLanguageTextHolder isNil ifTrue:[
cg@2434
  1183
	exampleLanguageTextHolder := '' asValue.
fm@2050
  1184
    ].
fm@2050
  1185
    ^ exampleLanguageTextHolder.
fm@2050
  1186
!
fm@2050
  1187
fm@2327
  1188
ignoreCaseHolder
fm@2327
  1189
fm@2327
  1190
    ignoreCaseHolder isNil ifTrue:[
cg@2434
  1191
	ignoreCaseHolder := false asValue.
fm@2327
  1192
"/ if your app needs to be notified of changes, uncomment one of the lines below:
fm@2327
  1193
"/       ignoreCaseHolder addDependent:self.
cg@2434
  1194
	ignoreCaseHolder onChangeSend:#ignoreCaseHolderChanged to:self.
fm@2327
  1195
fm@2327
  1196
    ].
fm@2327
  1197
    ^ ignoreCaseHolder.
fm@2327
  1198
fm@2327
  1199
    "Created: / 16-06-2007 / 06:45:04 / Administrador"
fm@2327
  1200
    "Modified: / 16-06-2007 / 19:32:15 / Administrador"
fm@2327
  1201
!
fm@2327
  1202
cg@2015
  1203
keyStringAndLanguageSelectionTable
cg@2015
  1204
    keyStringsToLanguageMappings isNil ifTrue:[
cg@2434
  1205
	keyStringsToLanguageMappings := KeyStringsToLanguageMappings new.
cg@2015
  1206
    ].
cg@2015
  1207
    ^ keyStringsToLanguageMappings.
cg@2015
  1208
!
cg@2015
  1209
cg@2015
  1210
keyStringAndLanguageSelectionTableColumnDescriptionHolder
cg@2015
  1211
    keyStringAndLanguageSelectionTableColumnDescriptionHolder isNil ifTrue:[
cg@2434
  1212
	keyStringAndLanguageSelectionTableColumnDescriptionHolder := ValueHolder new.
cg@2434
  1213
	keyStringAndLanguageSelectionTableColumnDescriptionHolder value:(self keyStringAndLanguageSelectionTableColumnDescription).
cg@2015
  1214
    ].
cg@2015
  1215
    ^ keyStringAndLanguageSelectionTableColumnDescriptionHolder.
cg@2015
  1216
!
cg@2015
  1217
cg@2015
  1218
languageAtCol:colNr
cg@2015
  1219
    ^ shownLanguages at:colNr-1.
cg@2015
  1220
!
cg@2015
  1221
cg@2015
  1222
languageShownHolderFor:lang
cg@2015
  1223
    |holder|
cg@2015
  1224
cg@2015
  1225
    languageShownHolders isNil ifTrue:[
cg@2434
  1226
	languageShownHolders := Dictionary new
cg@2015
  1227
    ].
cg@2434
  1228
    holder := languageShownHolders
cg@2434
  1229
		at:lang
cg@2434
  1230
		ifAbsentPut:[
cg@2434
  1231
		    |h|
cg@2434
  1232
cg@2434
  1233
		    h := true asValue.
cg@2434
  1234
		    h onChangeEvaluate:[
cg@2434
  1235
			h value ifTrue:[
cg@2434
  1236
			   self enableLanguageDisplayFor:lang
cg@2434
  1237
			] ifFalse:[
cg@2434
  1238
			   self disableLanguageDisplayFor:lang
cg@2434
  1239
			].
cg@2434
  1240
		    ].
cg@2434
  1241
		    h
cg@2434
  1242
		].
cg@2015
  1243
    ^ holder.
cg@2015
  1244
!
cg@2015
  1245
cg@2048
  1246
languageTextAcceptHolder
cg@2048
  1247
    languageTextAcceptHolder isNil ifTrue:[
cg@2434
  1248
	languageTextAcceptHolder := false asValue.
cg@2048
  1249
    ].
cg@2048
  1250
    ^ languageTextAcceptHolder.
cg@2048
  1251
!
cg@2048
  1252
cg@2015
  1253
languageTextHolder
cg@2015
  1254
    languageTextHolder isNil ifTrue:[
cg@2434
  1255
	languageTextHolder := '' asValue.
cg@2015
  1256
    ].
cg@2015
  1257
    ^ languageTextHolder.
cg@2015
  1258
!
cg@2015
  1259
cg@2015
  1260
languageTextModifiedHolder
cg@2015
  1261
    languageTextModifiedHolder isNil ifTrue:[
cg@2434
  1262
	languageTextModifiedHolder := false asValue.
cg@2015
  1263
    ].
cg@2015
  1264
    ^ languageTextModifiedHolder.
cg@2015
  1265
!
cg@2015
  1266
cg@2015
  1267
languagesList
cg@2015
  1268
    languagesList isNil ifTrue:[
cg@2434
  1269
	languagesList := List withAll:(self keyStringAndLanguageSelectionTable languages).
cg@2015
  1270
    ].
cg@2015
  1271
    ^ languagesList.
cg@2015
  1272
!
cg@2015
  1273
cg@2015
  1274
originalTextHolder
cg@2015
  1275
    originalTextHolder isNil ifTrue:[
cg@2434
  1276
	originalTextHolder := '' asValue.
cg@2015
  1277
    ].
cg@2015
  1278
    ^ originalTextHolder.
cg@2015
  1279
!
cg@2015
  1280
cg@2015
  1281
originalTextModifiedHolder
cg@2015
  1282
    originalTextModifiedHolder isNil ifTrue:[
cg@2434
  1283
	originalTextModifiedHolder := false asValue.
cg@2015
  1284
    ].
cg@2015
  1285
    ^ originalTextModifiedHolder.
cg@2015
  1286
!
cg@2015
  1287
fm@2323
  1288
pasteOriginalEnableHolder
cg@2434
  1289
   pasteOriginalEnableHolder isNil ifTrue:[pasteOriginalEnableHolder := false asValue].
fm@2323
  1290
    ^ pasteOriginalEnableHolder
fm@2323
  1291
!
fm@2323
  1292
fm@2051
  1293
pastePreviousTranslationEnableHolder
cg@2434
  1294
   pastePreviousTranslationEnableHolder isNil ifTrue:[pastePreviousTranslationEnableHolder := false asValue].
fm@2051
  1295
    ^ pastePreviousTranslationEnableHolder
fm@2051
  1296
!
fm@2051
  1297
fm@2327
  1298
searchBarImageInfoLabelHolder
fm@2327
  1299
fm@2327
  1300
    searchBarImageInfoLabelHolder isNil ifTrue:[
cg@2434
  1301
	searchBarImageInfoLabelHolder := nil asValue .
fm@2327
  1302
    ].
fm@2327
  1303
    ^ searchBarImageInfoLabelHolder.
fm@2327
  1304
fm@2327
  1305
    "Created: / 16-06-2007 / 10:06:28 / Administrador"
fm@2327
  1306
!
fm@2327
  1307
fm@2327
  1308
searchBarInfoLabelHolder
fm@2327
  1309
fm@2327
  1310
    searchBarInfoLabelHolder isNil ifTrue:[
cg@2434
  1311
	searchBarInfoLabelHolder := '' asValue .
fm@2327
  1312
    ].
fm@2327
  1313
    ^ searchBarInfoLabelHolder.
fm@2327
  1314
fm@2327
  1315
    "Created: / 16-06-2007 / 06:20:49 / Administrador"
fm@2327
  1316
!
fm@2327
  1317
fm@2327
  1318
searchBoxVisible
fm@2327
  1319
fm@2327
  1320
    searchBoxVisible isNil ifTrue:[
cg@3286
  1321
        searchBoxVisible := false asValue.
cg@3286
  1322
        searchBoxVisible 
cg@3286
  1323
            onChangeEvaluate:[ 
cg@3286
  1324
                self updateToolVisibility.
cg@3286
  1325
                searchBoxVisible value ifTrue:[
cg@3286
  1326
                    searchTextView takeFocus.
cg@3286
  1327
                ].
cg@3286
  1328
            ].
fm@2327
  1329
    ].
fm@2327
  1330
    ^ searchBoxVisible.
fm@2327
  1331
fm@2327
  1332
    "Created: / 15-06-2007 / 18:15:52 / Administrador"
fm@2327
  1333
!
fm@2327
  1334
fm@2051
  1335
searchForSimilarTranslationEnableHolder
cg@2434
  1336
   searchForSimilarTranslationEnableHolder isNil
cg@2434
  1337
	ifTrue:[searchForSimilarTranslationEnableHolder := true asValue].
fm@2051
  1338
    ^ searchForSimilarTranslationEnableHolder
fm@2051
  1339
!
fm@2051
  1340
fm@2327
  1341
searchTextHolder
fm@2327
  1342
fm@2327
  1343
    searchTextHolder isNil ifTrue:[
cg@2434
  1344
	searchTextHolder := ValueHolder new.
fm@2327
  1345
"/ if your app needs to be notified of changes, uncomment one of the lines below:
fm@2327
  1346
"/       userSelectedHolder addDependent:self.
fm@2327
  1347
"/       userSelectedHolder onChangeSend:#searchTextHolderChanged to:self.
fm@2327
  1348
    ].
fm@2327
  1349
    ^ searchTextHolder.
fm@2327
  1350
fm@2327
  1351
    "Created: / 15-06-2007 / 18:06:08 / Administrador"
fm@2327
  1352
!
fm@2327
  1353
fm@2327
  1354
searchTextModifiedHolder
fm@2327
  1355
fm@2327
  1356
    searchTextModifiedHolder isNil ifTrue:[
cg@2434
  1357
	searchTextModifiedHolder := false asValue .
fm@2327
  1358
"/ if your app needs to be notified of changes, uncomment one of the lines below:
fm@2327
  1359
"/       searchTextModifiedHolder addDependent:self.
fm@2327
  1360
       searchTextModifiedHolder onChangeSend:#searchTextModifiedHolderChanged to:self.
fm@2327
  1361
    ].
fm@2327
  1362
    ^ searchTextModifiedHolder.
fm@2327
  1363
fm@2327
  1364
    "Created: / 15-06-2007 / 18:07:19 / Administrador"
fm@2327
  1365
!
fm@2327
  1366
cg@2015
  1367
selectedKeyRow
cg@2015
  1368
    selectedKeyRow isNil ifTrue:[
cg@2434
  1369
	selectedKeyRow := ValueHolder new.
cg@2434
  1370
	selectedKeyRow onChangeSend:#selectionChanged to:self.
cg@2015
  1371
    ].
cg@2015
  1372
    ^ selectedKeyRow.
cg@2015
  1373
!
cg@2015
  1374
cg@2015
  1375
showMissingTranslationsOnly
cg@2015
  1376
    showMissingTranslationsOnly isNil ifTrue:[
cg@2434
  1377
	showMissingTranslationsOnly := false asValue.
cg@2434
  1378
	showMissingTranslationsOnly onChangeSend:#showMissingTranslationsOnlyChanged to:self.
cg@2015
  1379
    ].
cg@2015
  1380
    ^ showMissingTranslationsOnly.
cg@2015
  1381
!
cg@2015
  1382
cg@2015
  1383
shownLanguages
cg@2015
  1384
    shownLanguages isNil ifTrue:[
cg@2434
  1385
	shownLanguages := List new.
cg@2434
  1386
	shownLanguages addAll:(self languagesList).
cg@2434
  1387
	shownLanguages onChangeSend:#shownLanguagesChanged to:self.
cg@2015
  1388
    ].
cg@2015
  1389
    ^ shownLanguages.
cg@2015
  1390
!
cg@2015
  1391
cg@2015
  1392
stopApplicationIconVisibleHolder
cg@2015
  1393
    stopApplicationIconVisibleHolder isNil ifTrue:[
cg@2434
  1394
	stopApplicationIconVisibleHolder := false asValue.
cg@2015
  1395
    ].
cg@2015
  1396
    ^ stopApplicationIconVisibleHolder.
cg@2015
  1397
! !
cg@2015
  1398
cg@2048
  1399
!InternationalLanguageTranslationEditor methodsFor:'change & update'!
cg@2048
  1400
fm@2051
  1401
languageTextHolderValue: aString
fm@2051
  1402
fm@2163
  1403
    self languageTextHolder value: aString.
fm@2163
  1404
    self languageTextModifiedHolder value:true.
fm@2051
  1405
!
fm@2051
  1406
cg@2048
  1407
update:something with:aParameter from:changedObject
cg@2048
  1408
    changedObject == shownLanguages ifTrue:[
cg@2434
  1409
	 self shownLanguagesChanged.
cg@2434
  1410
	 ^ self.
cg@2048
  1411
    ].
fm@2049
  1412
    changedObject == languageTextAcceptHolder ifTrue:[
cg@2434
  1413
	 self updateLanguageTextModification.
cg@2434
  1414
	 ^ self.
fm@2049
  1415
    ].
fm@2050
  1416
    changedObject == exampleLanguageSelectionHolder ifTrue:[
cg@2434
  1417
	self updateExampleLanguageText.
cg@2434
  1418
	^ self.
cg@2434
  1419
    ].
fm@2051
  1420
    changedObject == showMissingTranslationsOnly ifTrue:[
cg@2434
  1421
	self showMissingTranslationsOnlyChanged.
cg@2434
  1422
	^ self.
cg@2434
  1423
    ].
fm@2051
  1424
!
fm@2051
  1425
fm@2051
  1426
updateCopyPreviousTranslationButtonEnabled
fm@2051
  1427
fm@2163
  1428
     self pastePreviousTranslationEnableHolder value: self shouldCopyPreviousTranslationButtonBeEnabled
fm@2050
  1429
!
fm@2050
  1430
fm@2050
  1431
updateExampleLanguageText
fm@2050
  1432
fm@2050
  1433
    self selectedKeyRow value isNil ifTrue:[^ self].
fm@2050
  1434
    self exampleLanguageTextHolder value:self currentExampleLanguageText
fm@2049
  1435
!
fm@2049
  1436
cg@2434
  1437
updateKeyStringsToLanguageMappings
cg@2434
  1438
cg@2434
  1439
      keyStringsToLanguageMappings
cg@2434
  1440
	at:lastSelectedKey
cg@2434
  1441
	language:lastLanguage
cg@2434
  1442
	put: self newLanguageText.
fm@2049
  1443
!
fm@2049
  1444
fm@2050
  1445
updateLanguageAndKeySelection
fm@2050
  1446
fm@2050
  1447
    self originalTextHolder value: self selectedKey.
fm@2051
  1448
    self languageTextHolder value: (self languageTextFromSelectedKeyFor: self currentLanguage).
fm@2051
  1449
    lastLanguage := self currentLanguage.
cg@2434
  1450
    lastSelectedKey := self selectedKey.
fm@2050
  1451
!
fm@2050
  1452
cg@2434
  1453
updateLanguageTextModification
cg@2434
  1454
     self languageTextModifiedHolder value ifTrue:[
cg@2434
  1455
	(self autoAccept or:[Dialog confirm:'Accept changed translation ?']) ifTrue:[
cg@2434
  1456
	    self languageTextModifiedHolder value:false.
cg@2434
  1457
	    self languageTextHolder value:languageEditor contents.
cg@2434
  1458
	    lastLanguage notNil ifTrue:[self updateKeyStringsToLanguageMappings.]
cg@2434
  1459
	]
fm@2049
  1460
    ].
fm@2049
  1461
!
fm@2049
  1462
fm@2049
  1463
updateOriginalTextModification
fm@2049
  1464
fm@2163
  1465
    |answer|
fm@2049
  1466
sv@3245
  1467
        self originalTextModifiedHolder value ifTrue:[
sv@3245
  1468
            answer := OptionBox
sv@3245
  1469
                          request:'Accept changed original text (key) ?'
sv@3245
  1470
                          label:'Original text (key) changed'
sv@3245
  1471
                          image:(WarningBox iconBitmap)
sv@3245
  1472
                          buttonLabels:#('Cancel' 'Accept' 'Accept As New')
sv@3245
  1473
                          values:#(nil #accept #acceptAsNew)
sv@3245
  1474
                          default:#acceptAsNew.
sv@3245
  1475
sv@3245
  1476
            answer isNil ifTrue:[^ self originalTextModifiedHolder value:false. ].
sv@3245
  1477
            answer == #accept ifTrue:[
sv@3245
  1478
    self shouldImplement.        ].
sv@3245
  1479
            answer == #acceptAsNew ifTrue:[
sv@3245
  1480
    self shouldImplement.        ].
sv@3245
  1481
        ].
fm@2323
  1482
!
fm@2323
  1483
fm@2323
  1484
updatePasteOriginalButtonEnabled
fm@2323
  1485
fm@2323
  1486
     self pasteOriginalEnableHolder value: self shouldPasteOriginalButtonBeEnabled
cg@2048
  1487
! !
cg@2048
  1488
fm@2050
  1489
!InternationalLanguageTranslationEditor methodsFor:'dialogs'!
fm@2050
  1490
fm@2051
  1491
requestEncoderDialog
fm@2050
  1492
fm@2051
  1493
   |box val characterCollection|
fm@2051
  1494
fm@2051
  1495
    val := '' asValue.
fm@2051
  1496
    box := Dialog new.
fm@2051
  1497
    (box addTextLabel:'Select or write the encoder') adjust:#left.
fm@2051
  1498
    box addVerticalSpace.
cg@2434
  1499
    characterCollection := CharacterEncoder supportedExternalEncodings
cg@2434
  1500
	inject: OrderedCollection new
cg@2434
  1501
	into:[:collection :each |
cg@2434
  1502
	    collection add: each first;
cg@2434
  1503
			yourself].
fm@2051
  1504
    (box addComboBoxOn:val) list: characterCollection.
fm@2051
  1505
    box addOkButton.
fm@2051
  1506
    box open.
fm@2051
  1507
    ^val value
fm@2051
  1508
!
fm@2051
  1509
fm@2051
  1510
requestEncoderStringFor: lang
fm@2051
  1511
  "Returns an encoder string and updates the language's info"
fm@2051
  1512
    |encoderString encoder|
fm@2051
  1513
    encoderString := self requestEncoderDialog.
fm@2051
  1514
    encoderString notEmpty ifTrue:[
cg@2434
  1515
	encoder := CharacterEncoder encoderFor: encoderString ifAbsent:nil.
cg@2434
  1516
	encoder notNil ifTrue:[keyStringsToLanguageMappings atLanguage: lang putEncoder: encoder.].
fm@2051
  1517
    ].
fm@2051
  1518
    ^encoderString
fm@2050
  1519
!
fm@2050
  1520
cg@2434
  1521
requestFilename
fm@2050
  1522
fm@2050
  1523
    |aFilename|
fm@2050
  1524
cg@2434
  1525
    aFilename := Dialog
cg@2434
  1526
	requestFileName:(resources string:'Name of resource file:')
cg@2434
  1527
	default:nil
cg@2434
  1528
	pattern:'*.rs'.
fm@2050
  1529
fm@2050
  1530
    aFilename isEmptyOrNil ifTrue:[^ nil ].
fm@2050
  1531
    ^aFilename asFilename
fm@2050
  1532
!
fm@2050
  1533
cg@2434
  1534
requestFilenameFor: lang
fm@2051
  1535
  "Returns a filename to save the language resource and updates the language's info"
fm@2051
  1536
    |aFilename|
fm@2051
  1537
cg@2434
  1538
    aFilename := Dialog
cg@2434
  1539
	requestFileName:(resources string:'Name of resource file to save %1:' with:lang asString)
cg@2434
  1540
	default:nil
cg@2434
  1541
	pattern:'*.rs'.
fm@2051
  1542
fm@2051
  1543
    aFilename isEmptyOrNil ifTrue:[^ nil ].
fm@2051
  1544
    keyStringsToLanguageMappings atLanguage: lang putFilename: aFilename.
fm@2051
  1545
    ^aFilename asFilename
fm@2051
  1546
!
fm@2051
  1547
fm@2050
  1548
requestLanguage
cg@2434
  1549
    ^ Dialog
cg@2434
  1550
	choose:(resources string:'For which language ?')
cg@2434
  1551
	fromList:languagesList
cg@2434
  1552
	lines:10.
fm@2327
  1553
!
fm@2327
  1554
fm@2327
  1555
requestLanguageToSave
cg@2434
  1556
    ^ Dialog
cg@2434
  1557
	choose:'Which language do you want to save?'
cg@2434
  1558
	fromList:languagesList
cg@2434
  1559
	lines:10
cg@2410
  1560
!
cg@2410
  1561
cg@2410
  1562
requestPackage
cg@2419
  1563
    |package allProjects projectsWithResources|
cg@2419
  1564
matilk@3264
  1565
    allProjects := Smalltalk allPackageIDs.
cg@2419
  1566
    projectsWithResources := allProjects
cg@2570
  1567
                                select:[:pID |
cg@2570
  1568
                                    |dir|
cg@2570
  1569
                                    dir := Smalltalk projectDirectoryForPackage:pID.
cg@2570
  1570
                                    dir notNil and:[
cg@2570
  1571
                                    (dir asFilename construct:'resources') exists]
cg@2570
  1572
                                ].
cg@2410
  1573
cg@2410
  1574
    package := Dialog
cg@2570
  1575
        requestProject:(resources string:'Name of Package:')
cg@2570
  1576
        from:projectsWithResources
cg@2570
  1577
        initialAnswer:LastProject
cg@2570
  1578
        suggestions:nil.
cg@2410
  1579
cg@2410
  1580
    package isEmptyOrNil ifTrue:[^ nil ].
cg@2410
  1581
    LastProject := package.
cg@2410
  1582
    ^ package
fm@2050
  1583
! !
fm@2050
  1584
fm@2327
  1585
!InternationalLanguageTranslationEditor methodsFor:'images'!
fm@2327
  1586
fm@2327
  1587
restartSearchBarIcon
fm@2327
  1588
fm@2327
  1589
    ^ self class restartSearchBarIcon
fm@2327
  1590
!
fm@2327
  1591
fm@2327
  1592
warningSearchBarIcon
fm@2327
  1593
fm@2327
  1594
    ^ self class warningSearchBarIcon
fm@2327
  1595
! !
fm@2327
  1596
cg@2015
  1597
!InternationalLanguageTranslationEditor methodsFor:'initialization & release'!
cg@2015
  1598
cg@2015
  1599
closeRequest
cg@2015
  1600
    "asks for permission before closing"
cg@2015
  1601
cg@2015
  1602
    self hasUnsavedChanges ifTrue:[
cg@2434
  1603
	(Dialog
cg@2434
  1604
	    confirm:(resources string:'Close without saving ?')
cg@2434
  1605
	    default:false) ifFalse:[
cg@2434
  1606
	    ^ self
cg@2434
  1607
	]
cg@2015
  1608
    ].
cg@2015
  1609
cg@2015
  1610
    super closeRequest
cg@2015
  1611
!
cg@2015
  1612
cg@2015
  1613
initialize
cg@2015
  1614
    modified := false.
cg@2031
  1615
    inSingleFileMode := false.
cg@3286
  1616
    methodsUsingKey := Dictionary new.
cg@2015
  1617
    super initialize
cg@2015
  1618
!
cg@2015
  1619
fm@2049
  1620
languageEditorBuilt:aView
fm@2049
  1621
    languageEditor := aView.
fm@2049
  1622
!
fm@2049
  1623
cg@2015
  1624
postBuildDataSet:aView
fm@2049
  1625
    dataSetView := aView.
fm@2049
  1626
    aView selectedColIndexHolder onChangeSend:#selectionChanged to:self.
cg@2015
  1627
! !
cg@2015
  1628
fm@2327
  1629
!InternationalLanguageTranslationEditor methodsFor:'initialize'!
fm@2327
  1630
fm@2327
  1631
postBuildSearchBoxView: aBoxView
fm@2327
  1632
fm@2327
  1633
    searchBoxView := aBoxView
fm@2327
  1634
fm@2327
  1635
    "Created: / 15-06-2007 / 18:02:38 / Administrador"
fm@2327
  1636
!
fm@2327
  1637
fm@2327
  1638
postBuildSearchTextView: anEditFieldView
fm@2327
  1639
fm@2327
  1640
    searchTextView := anEditFieldView
fm@2327
  1641
fm@2327
  1642
    "Created: / 15-06-2007 / 18:17:15 / Administrador"
fm@2327
  1643
!
fm@2327
  1644
fm@2327
  1645
postBuildTranslationsPanel: aPanel
fm@2327
  1646
fm@2327
  1647
    translationsPanel := aPanel
fm@2327
  1648
!
fm@2327
  1649
fm@2327
  1650
postBuildWith:aBuilder
fm@2327
  1651
fm@2327
  1652
    super postBuildWith:aBuilder.
fm@2327
  1653
    self updateToolVisibility.
fm@2327
  1654
! !
fm@2327
  1655
cg@2015
  1656
!InternationalLanguageTranslationEditor methodsFor:'menu actions'!
cg@2015
  1657
cg@2015
  1658
addLanguage
cg@2015
  1659
    |lang|
cg@2015
  1660
cg@2410
  1661
    lang := Dialog request:(resources string:'New language (ISO symbol):').
cg@2015
  1662
    lang isEmptyOrNil ifTrue:[^ self].
cg@2410
  1663
    self addLanguage:lang
cg@2410
  1664
!
cg@2410
  1665
cg@2410
  1666
addLanguage:langArg
cg@2410
  1667
    |lang|
cg@2410
  1668
cg@2410
  1669
    lang := langArg asSymbol.
cg@2015
  1670
    (keyStringsToLanguageMappings includesLanguage:lang) ifTrue:[^ self ].
cg@2015
  1671
cg@2015
  1672
    keyStringsToLanguageMappings addLanguage:lang.
cg@2015
  1673
    self languagesList add:lang.
cg@2015
  1674
    self shownLanguages add:lang.
cg@2015
  1675
    modified := true.
cg@2015
  1676
!
cg@2015
  1677
cg@2015
  1678
addTranslation
cg@2015
  1679
    |key index|
cg@2015
  1680
cg@2015
  1681
    key := Dialog request:'New Key:'.
fm@2051
  1682
    key isEmpty ifTrue:[^self].
fm@2163
  1683
    (self includesKey:key) ifFalse:[
cg@2434
  1684
	keyStringsToLanguageMappings addKey:key.
cg@2434
  1685
	modified := true.
cg@2015
  1686
    ].
fm@2051
  1687
   index := keyStringsToLanguageMappings indexOfKey:key.
fm@2051
  1688
   self selectedKeyRow value:index
cg@2015
  1689
!
cg@2015
  1690
cg@3286
  1691
browseReferringMethods
cg@3286
  1692
    |selectedKey methods browser|
cg@3286
  1693
cg@3286
  1694
    selectedKey := self selectedKey.
cg@3286
  1695
    selectedKey isNil ifTrue:[^ Dialog information: 'No selected key'].
cg@3286
  1696
cg@3286
  1697
    methods := methodsUsingKey at:selectedKey ifAbsent:nil.
cg@3286
  1698
    methods isEmptyOrNil ifTrue:[
cg@3286
  1699
        Dialog information:(resources stringWithCRs:'oops - no method remembered.\Please rerun the extract from XXX menu operation').
cg@3286
  1700
        ^ self.
cg@3286
  1701
    ].    
cg@3286
  1702
    browser := UserPreferences systemBrowserClass browseMethods:methods.
cg@3286
  1703
    browser autoSearch:selectedKey ignoreCase:true.
cg@3286
  1704
!
cg@3286
  1705
fm@2163
  1706
changeLastNameSpace
fm@2163
  1707
fm@2163
  1708
    |nameSpace defaultNameSpace|
fm@2163
  1709
fm@2163
  1710
    lastNameSpace notNil ifTrue:[defaultNameSpace := lastNameSpace name].
fm@2163
  1711
    nameSpace := Dialog requestNameSpace:'NameSpace:' title:'Search String in Name Space:' initialAnswer:defaultNameSpace.
fm@2163
  1712
    nameSpace isNil ifTrue:[^self].
fm@2163
  1713
    nameSpace := Smalltalk at:nameSpace asSymbol.
fm@2163
  1714
    nameSpace isNil ifTrue:[
cg@2434
  1715
	^Dialog information:(resources string:'No such nameSpace exists.')
fm@2163
  1716
    ].
fm@2163
  1717
    lastNameSpace := nameSpace.
fm@2163
  1718
!
fm@2163
  1719
fm@2327
  1720
changeLastPackage
fm@2327
  1721
fm@2327
  1722
    |package defaultPackage|
fm@2327
  1723
fm@2327
  1724
    lastPackage notNil ifTrue:[defaultPackage := lastPackage].
fm@2327
  1725
    package := Dialog
cg@2434
  1726
	    requestProject:'Package:'
cg@2434
  1727
	    initialAnswer:defaultPackage
cg@2434
  1728
	    suggestions:#('foo' 'bar' 'baz').
fm@2327
  1729
    package isNil ifTrue:[
cg@2434
  1730
	^ self "/ Dialog information:(resources string:'No such package exists.')
fm@2327
  1731
    ].
fm@2327
  1732
    lastPackage := package.
fm@2327
  1733
!
fm@2327
  1734
cg@2015
  1735
extractTranslationsFromClass
cg@2015
  1736
    |aClass newTranslations|
cg@2015
  1737
cg@2434
  1738
    aClass := Dialog
cg@2434
  1739
		requestClass:'Class to extract translations from:'
cg@2434
  1740
		okLabel:'OK'
cg@2434
  1741
		initialAnswer:(lastExtractedClass ? LastExtractedClass).
cg@2015
  1742
    aClass isNil ifTrue:[^ self ].
cg@2015
  1743
cg@2015
  1744
    lastExtractedClass := LastExtractedClass := aClass.
cg@2015
  1745
cg@2032
  1746
    newTranslations := self extractTranslationsFromClass:aClass.
cg@2032
  1747
    self addAllTranslations:newTranslations.
cg@2032
  1748
!
cg@2032
  1749
fm@2163
  1750
extractTranslationsFromNameSpace
fm@2163
  1751
fm@2163
  1752
    |newTranslations|
fm@2163
  1753
fm@2163
  1754
    self changeLastNameSpace.
fm@2163
  1755
    lastNameSpace isNil ifTrue:[^self.].
fm@2163
  1756
    newTranslations := OrderedCollection new.
fm@2163
  1757
    lastNameSpace allClassesDo:[:eachClass |
cg@2434
  1758
	newTranslations addAll:( self extractTranslationsFromClass:eachClass theNonMetaclass).
fm@2163
  1759
    ].
fm@2163
  1760
    self addAllTranslations:newTranslations.
fm@2163
  1761
!
fm@2163
  1762
cg@2032
  1763
extractTranslationsFromProject
jan@3189
  1764
    |projectID newTranslations|
cg@2032
  1765
mawalch@3454
  1766
    projectID := Dialog requestProject:(resources string:'Package to extract translations from:') initialAnswer:(lastExtractedProject ? LastExtractedProject) suggestions:(OrderedCollection with:(lastExtractedProject ? LastExtractedProject)).
cg@2032
  1767
    projectID notNil ifTrue:[
jan@3187
  1768
        projectID := projectID withoutSeparators asSymbol.
cg@2032
  1769
    ].
cg@2032
  1770
    projectID isEmptyOrNil ifTrue:[^ self ].
cg@2032
  1771
cg@2032
  1772
    lastExtractedProject := LastExtractedProject := projectID.
cg@2032
  1773
cg@2015
  1774
    newTranslations := Set new.
cg@3282
  1775
    self withWaitCursorDo:[
cg@3282
  1776
        Smalltalk allClassesDo:[:eachClass |
cg@3282
  1777
            eachClass theNonMetaclass instAndClassMethodsDo:[:eachMethod |
mawalch@3454
  1778
                eachMethod package == projectID ifTrue:[
cg@3282
  1779
                    newTranslations addAll:( self extractTranslationsFromMethod:eachMethod ).
cg@3282
  1780
                ]
cg@3282
  1781
            ].
jan@3189
  1782
        ].
cg@3282
  1783
cg@3282
  1784
        self addAllTranslations:newTranslations.
cg@2015
  1785
    ].
mawalch@3454
  1786
jan@3189
  1787
    "Modified: / 19-02-2015 / 11:44:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
mawalch@3454
  1788
    "Modified (format): / 02-08-2017 / 17:07:55 / mawalch"
jan@3189
  1789
!
jan@3189
  1790
jan@3189
  1791
generateMissingTranslations: keys for: languages using: translator    
jan@3189
  1792
    keys do:[:string |
jan@3189
  1793
        languages do:[:lang | 
jan@3189
  1794
            | translation |
jan@3189
  1795
jan@3189
  1796
            translation := keyStringsToLanguageMappings at:string language:lang.
jan@3189
  1797
            translation isNil ifTrue:[ 
jan@3189
  1798
                translation := translator value: lang value: string.
jan@3189
  1799
                translation notNil ifTrue:[ 
jan@3189
  1800
                    keyStringsToLanguageMappings at: string language: lang put: translation.  
jan@3189
  1801
                ].
jan@3189
  1802
            ].
jan@3189
  1803
        ].
jan@3189
  1804
    ].
jan@3189
  1805
jan@3189
  1806
    "Created: / 19-02-2015 / 12:31:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
jan@3189
  1807
!
jan@3189
  1808
jan@3189
  1809
generateMissingTranslationsFor: languages
jan@3189
  1810
    self 
jan@3189
  1811
        generateMissingTranslations: keyStringsToLanguageMappings keys
jan@3189
  1812
                                for: languages
jan@3189
  1813
                              using: [ :lang :string | '**%1** %2' bindWith: lang asUppercase with: string ]
jan@3189
  1814
jan@3189
  1815
    "Created: / 19-02-2015 / 12:39:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
jan@3189
  1816
!
jan@3189
  1817
jan@3189
  1818
generateMissingTranslationsForAll
jan@3189
  1819
    self generateMissingTranslationsFor: keyStringsToLanguageMappings languages
jan@3189
  1820
jan@3189
  1821
    "Created: / 19-02-2015 / 12:40:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
cg@2015
  1822
!
cg@2015
  1823
fm@2327
  1824
importExistingTranslationsFromFile
cg@2410
  1825
    self information:'The import function is not available in this release'.
fm@2327
  1826
!
fm@2327
  1827
fm@2163
  1828
inspectCanvasMissingStrings
fm@2163
  1829
fm@2163
  1830
    |spec nameSpace missingStrings|
fm@2163
  1831
fm@2163
  1832
    missingStrings := OrderedCollection new.
fm@2163
  1833
    nameSpace := Dialog requestNameSpace:'NameSpace:' title:'Specify NameSpace to look for missing strings' initialAnswer:nil.
fm@2163
  1834
    nameSpace := Smalltalk at:nameSpace asSymbol.
fm@2163
  1835
    nameSpace isNil ifTrue:[
cg@2434
  1836
	^Dialog information:(resources string:'No such nameSpace exists.?')
fm@2163
  1837
    ].
fm@2163
  1838
fm@2163
  1839
    nameSpace allClassesDo:[:cls |
cg@2434
  1840
	cls theMetaclass methodsDo:[:m |
cg@2434
  1841
	    m hasResource ifTrue:[
cg@2434
  1842
		(m resources includesKey:#canvas) ifTrue:[
cg@2434
  1843
		    spec := (cls perform:m selector) decodeAsLiteralArray.
cg@2434
  1844
		    spec do:[:eachComponent |
cg@2434
  1845
			eachComponent translationKeysDo:[:k |
cg@2434
  1846
			    (self includesKey: k) ifFalse:[
cg@2434
  1847
				missingStrings add: k.
cg@2434
  1848
				Transcript showCR: k storeString, '                         ', m printString]]
cg@2434
  1849
		    ]
cg@2434
  1850
		]
cg@2434
  1851
	    ]
cg@2434
  1852
	]
fm@2163
  1853
    ].
fm@2163
  1854
    missingStrings asSet inspect
fm@2163
  1855
!
fm@2163
  1856
cg@2015
  1857
menuNew
cg@2015
  1858
    modified ifTrue:[
cg@2434
  1859
	(Dialog
cg@2434
  1860
	    confirm:(resources stringWithCRs:'Modified translations have not been changed.\\Create new translations set anyway ?')
cg@2434
  1861
	    default:false) ifFalse:[^ self].
cg@2015
  1862
    ].
cg@2015
  1863
cg@2015
  1864
    keyStringsToLanguageMappings initialize.
cg@2015
  1865
    keyStringsToLanguageMappings changed.
cg@2015
  1866
cg@2015
  1867
    self languagesList contents:self keyStringAndLanguageSelectionTable languages.
cg@2015
  1868
    self shownLanguages contents:self keyStringAndLanguageSelectionTable languages.
cg@2015
  1869
    modified := false.
cg@2015
  1870
!
cg@2015
  1871
cg@2015
  1872
menuOpen
fm@2050
  1873
    |aFilename|
cg@2015
  1874
fm@2163
  1875
    self withWaitCursorDo:[
cg@2434
  1876
	aFilename := self requestFilename.
cg@2434
  1877
	aFilename isNil ifTrue:[^ self ].
cg@2434
  1878
	self readResourceFile:aFilename.
fm@2163
  1879
    ]
cg@2015
  1880
!
cg@2015
  1881
cg@2410
  1882
menuOpenByPackage
cg@2410
  1883
    |package|
cg@2410
  1884
cg@2410
  1885
    self withWaitCursorDo:[
cg@2434
  1886
	package := self requestPackage.
cg@2434
  1887
	package isNil ifTrue:[^ self ].
cg@2434
  1888
	self readResourceFileForPackage:package.
cg@2410
  1889
    ]
cg@2410
  1890
!
cg@2410
  1891
cg@2015
  1892
menuSave
fm@2050
  1893
"Saves the language selected in the fileName from where the language resource was obtained."
fm@2053
  1894
    |lang|
cg@2015
  1895
fm@2327
  1896
    lang := self requestLanguageToSave.
fm@2050
  1897
    lang isNil ifTrue:[^ self].
fm@2053
  1898
    self saveLanguage: lang
fm@2053
  1899
!
fm@2053
  1900
fm@2053
  1901
menuSaveAll
fm@2053
  1902
"Saves all the languages in the fileName from where the language resource was obtained."
cg@2434
  1903
    keyStringsToLanguageMappings languagesInUse do:[:each | self saveLanguage: each].
cg@2015
  1904
!
cg@2015
  1905
cg@2015
  1906
menuSaveAs
fm@2050
  1907
"Saves the language selected in the specified fileName."
fm@2050
  1908
     |lang aFilename|
cg@2015
  1909
fm@2327
  1910
    lang := self requestLanguageToSave.
cg@2434
  1911
    lang isNil ifTrue:[^ self].
fm@2053
  1912
    aFilename := self requestFilenameFor:lang.
fm@2050
  1913
    aFilename isNil ifTrue:[^ self].
fm@2050
  1914
    self saveResourceFile:aFilename for:lang asSymbol
cg@2015
  1915
!
cg@2015
  1916
cg@2015
  1917
openAboutThisApplication
cg@2015
  1918
    "This method was generated by the Browser.
cg@2015
  1919
     It will be invoked when the menu-item 'help-about' is selected."
cg@2015
  1920
cg@2015
  1921
    "/ could open a customized aboutBox here ...
cg@2015
  1922
    super openAboutThisApplication
cg@2015
  1923
!
cg@2015
  1924
cg@2015
  1925
openDocumentation
cg@2015
  1926
    "This method was generated by the Browser.
cg@2015
  1927
     It will be invoked when the menu-item 'help-documentation' is selected."
cg@2015
  1928
cg@2015
  1929
    "/ change below as required ...
cg@2015
  1930
cg@2015
  1931
    "/ to open an HTML viewer on some document (under 'doc/online/<language>/' ):
cg@2413
  1932
    HTMLDocumentView openFullOnDocumentationFile:'tools/languageEditor/TOP.html'.
cg@2015
  1933
cg@2015
  1934
    "/ add application-specific help files under the 'doc/online/<language>/help/appName'
cg@2015
  1935
    "/ directory, and open a viewer with:
cg@2015
  1936
    "/ HTMLDocumentView openFullOnDocumentationFile:'help/<MyApplication>/TOP.html'.
cg@2015
  1937
!
cg@2015
  1938
cg@2015
  1939
readResourceFile:aFilename
cg@2031
  1940
    |lang|
cg@2031
  1941
fm@2327
  1942
    lang := self requestLanguage.
cg@2031
  1943
    lang isNil ifTrue:[^ self ].
cg@2031
  1944
cg@2031
  1945
    self readResourceFile:aFilename asLanguage:lang asSymbol
cg@2031
  1946
!
cg@2031
  1947
cg@2410
  1948
readResourceFileForPackage:aPackage
cg@2410
  1949
    |allLanguages lang packageDir resourceDir langFile|
cg@2410
  1950
cg@2410
  1951
    packageDir := Smalltalk packageDirectoryForPackageId:aPackage.
cg@2410
  1952
    resourceDir := packageDir asFilename construct:'resources'.
cg@2410
  1953
cg@2410
  1954
    allLanguages := Set new.
cg@2410
  1955
    resourceDir directoryContentsAsFilenamesDo:[:eachFile |
cg@2434
  1956
	eachFile suffix = 'rs' ifTrue:[
cg@2434
  1957
	    (('##.rs' match:eachFile baseName)
cg@2434
  1958
	    or:[('##-##.rs' match:eachFile baseName)]) ifTrue:[
cg@2434
  1959
		allLanguages add:(eachFile withoutSuffix baseName)
cg@2434
  1960
	    ].
cg@2434
  1961
	].
cg@2410
  1962
    ].
cg@2410
  1963
cg@2410
  1964
    allLanguages addAll:languagesList.
cg@2410
  1965
    allLanguages := allLanguages asSortedCollection.
cg@2410
  1966
cg@2434
  1967
    lang := Dialog
cg@2434
  1968
	choose:(resources string:'For which language ?')
cg@2434
  1969
	fromList:allLanguages
cg@2434
  1970
	values:allLanguages
cg@2434
  1971
	buttons:(resources array:#('All'))
cg@2434
  1972
	values:#(all)
cg@2434
  1973
	lines:10
cg@2434
  1974
	cancel:nil.
cg@2410
  1975
cg@2410
  1976
    lang isNil ifTrue:[^ self ].
cg@2410
  1977
cg@2410
  1978
    langFile := resourceDir construct:lang,'.rs'.
cg@2410
  1979
cg@2410
  1980
    lang == #all ifTrue:[
cg@2434
  1981
	allLanguages do:[:lang |
cg@2434
  1982
	    self addLanguage:lang.
cg@2434
  1983
	    self readResourceFile:(resourceDir construct:lang,'.rs') asLanguage:lang.
cg@2434
  1984
	].
cg@2410
  1985
    ] ifFalse:[
cg@2434
  1986
	self readResourceFile:langFile asLanguage:lang asSymbol
cg@2410
  1987
    ].
cg@2410
  1988
!
cg@2410
  1989
fm@2050
  1990
removeLanguage
sv@3246
  1991
    |languagesToRemove|
sv@3246
  1992
sv@3246
  1993
    languagesToRemove := Dialog chooseMultiple:'Which language(s) do you want to remove?' fromList:languagesList lines:10.
sv@3246
  1994
    languagesToRemove isEmptyOrNil ifTrue:[^ self ].
sv@3246
  1995
    (Dialog confirm: 'Are you sure to remove the languages: ', languagesToRemove printString) ifTrue:[
sv@3246
  1996
          self languagesList removeAll:languagesToRemove.
sv@3246
  1997
          self shownLanguages removeAll:languagesToRemove.
cg@2434
  1998
    ].
cg@2015
  1999
!
cg@2015
  2000
cg@2015
  2001
removeTranslation
cg@2015
  2002
    |rowSelectionIndex selectedKey|
cg@2015
  2003
cg@2015
  2004
    rowSelectionIndex := self selectedKeyRow value.
fm@2163
  2005
    rowSelectionIndex isNil ifTrue:[^self].
cg@2015
  2006
    rowSelectionIndex ~~ 0 ifTrue:[
cg@2434
  2007
	selectedKey := keyStringsToLanguageMappings keyAt:rowSelectionIndex ifAbsent:nil.
cg@2434
  2008
	selectedKey isNil ifTrue:[^self].
cg@2434
  2009
	(Dialog confirm:(resources string:'Really remove key %1' with:selectedKey)) ifTrue:[
cg@2434
  2010
	    keyStringsToLanguageMappings removeKey:selectedKey.
cg@2434
  2011
	].
cg@2015
  2012
    ].
cg@2015
  2013
!
cg@2015
  2014
cg@2015
  2015
runApplicationAndCollectTranslations
cg@2047
  2016
    |applicationClass newTranslations pseudoPack app startSelector|
cg@2015
  2017
cg@2015
  2018
    monitoredApplication notNil ifTrue:[
cg@3286
  2019
        monitoredApplication terminate.
cg@3286
  2020
        [monitoredApplication notNil] whileTrue:[
cg@3286
  2021
            Delay waitForSeconds:0.1
cg@3286
  2022
        ].
cg@2015
  2023
    ].
cg@2015
  2024
cg@2434
  2025
    applicationClass := Dialog
cg@3286
  2026
                requestClass:'Application class to start and collect translations from:'
cg@3286
  2027
                okLabel:'OK'
cg@3286
  2028
                initialAnswer:(lastExtractedApplicationClass ? LastExtractedApplicationClass ).
cg@2015
  2029
    applicationClass isNil ifTrue:[^ self ].
cg@3286
  2030
    applicationClass isNameSpace ifTrue:[
cg@3286
  2031
        Dialog warn:'Entered class is a NameSpace'.
cg@3286
  2032
        ^ self.
cg@2047
  2033
    ].
cg@2047
  2034
cg@2047
  2035
    applicationClass isVisualStartable ifTrue:[
cg@3286
  2036
        startSelector := #open
cg@2047
  2037
    ] ifFalse:[
cg@3286
  2038
        startSelector := Dialog
cg@3286
  2039
                    request:'Entered class seems to be no application class. Ok to start using selector:'
cg@3286
  2040
                    initialAnswer:((applicationClass respondsTo:#'start')
cg@3286
  2041
                                        ifTrue:#'start'
cg@3286
  2042
                                        ifFalse:#'new')
cg@3286
  2043
                    okLabel:'START'
cg@3286
  2044
                    title:'Start Application'.
cg@3286
  2045
        startSelector isNil ifTrue:[
cg@3286
  2046
            ^ self
cg@3286
  2047
        ].
cg@3286
  2048
        startSelector := startSelector asSymbol.
cg@2047
  2049
    ].
cg@2015
  2050
cg@2015
  2051
    lastExtractedApplicationClass := LastExtractedApplicationClass := applicationClass.
cg@2015
  2052
cg@2015
  2053
    newTranslations := Set new.
cg@2015
  2054
cg@2015
  2055
    pseudoPack := AccessCollectingPseudoResourcePack new.
cg@2015
  2056
    pseudoPack realResourcePack:(applicationClass classResources).
cg@3286
  2057
    pseudoPack watchingTranslationEditor:self.
cg@2015
  2058
cg@2015
  2059
    self stopApplicationIconVisibleHolder value:true.
cg@2015
  2060
cg@3286
  2061
    monitoredApplication := 
cg@3286
  2062
        [
cg@3286
  2063
            [
cg@3286
  2064
                app := applicationClass new.
cg@3286
  2065
                app resources:pseudoPack.
cg@3286
  2066
                
cg@3286
  2067
                app perform:startSelector.
cg@3286
  2068
                app window waitUntilVisible.
cg@3286
  2069
                app window waitUntilClosed.
cg@3286
  2070
            ] ensure:[
cg@3286
  2071
                app closeRequest.
cg@3286
  2072
                self stopApplicationIconVisibleHolder value:false.
cg@3286
  2073
                monitoredApplication := nil.
cg@3286
  2074
            ].
cg@3286
  2075
        ] fork.
fm@2163
  2076
!
fm@2163
  2077
fm@2163
  2078
searchStringInLastNameSpace
fm@2163
  2079
fm@2323
  2080
    |selectedKey browser lastSearchPatterns|
fm@2163
  2081
fm@2163
  2082
    selectedKey := self selectedKey.
fm@2163
  2083
    selectedKey isNil ifTrue:[^Dialog information: 'No selected key'].
fm@2163
  2084
    browser := NewSystemBrowser new "open".
fm@2163
  2085
    browser allButOpen.
fm@2323
  2086
    lastSearchPatterns := browser lastSearchPatterns.
fm@2323
  2087
    (lastSearchPatterns notNil and:[lastSearchPatterns first ~= selectedKey]) ifTrue:[
cg@2434
  2088
	browser lastSearchPatterns addFirst: selectedKey
fm@2163
  2089
    ].
fm@2327
  2090
    SearchDialog lastStringSearchArea: #currentNameSpace.
fm@2163
  2091
    lastNameSpace isNil ifTrue:[
cg@2434
  2092
	self changeLastNameSpace.
fm@2163
  2093
    ].
fm@2163
  2094
    lastNameSpace notNil ifTrue:[
fm@2163
  2095
"/        browser navigationState selectedClasses value: lastNameSpace allClasses.
cg@2434
  2096
	browser navigationState nameSpaceFilter value: (OrderedCollection with:lastNameSpace name).
cg@2434
  2097
	browser navigationState selectedNamespaces value: (OrderedCollection with:lastNameSpace name).
fm@2163
  2098
    ].
fm@2163
  2099
    self withWaitCursorDo:[
cg@2434
  2100
	browser browseMenuMethodsWithString
fm@2163
  2101
    ].
fm@2327
  2102
!
fm@2327
  2103
fm@2327
  2104
searchStringInLastPackage
fm@2327
  2105
fm@2327
  2106
    | selectedKey browser lastSearchPatterns|
fm@2327
  2107
fm@2327
  2108
    selectedKey := self selectedKey.
cg@3286
  2109
    selectedKey isNil ifTrue:[^ Dialog information: 'No selected key'].
cg@3286
  2110
fm@2327
  2111
    browser := NewSystemBrowser new "open".
fm@2327
  2112
    browser allButOpen.
cg@3286
  2113
    
fm@2327
  2114
    lastSearchPatterns := browser lastSearchPatterns.
fm@2327
  2115
    (lastSearchPatterns notNil and:[lastSearchPatterns first ~= selectedKey]) ifTrue:[
cg@3286
  2116
        browser lastSearchPatterns addFirst: selectedKey
fm@2327
  2117
    ].
fm@2327
  2118
    SearchDialog lastStringSearchArea: #currentPackage.
fm@2327
  2119
    lastPackage isNil ifTrue:[
cg@3286
  2120
        self changeLastPackage.
fm@2327
  2121
    ].
fm@2327
  2122
    lastPackage notNil ifTrue:[
fm@2327
  2123
"/        browser navigationState selectedClasses value: lastNameSpace allClasses.
cg@3286
  2124
        browser navigationState packageFilter value: (OrderedCollection with:lastPackage).
cg@3286
  2125
        browser navigationState selectedProjects value: (OrderedCollection with:lastPackage).
fm@2327
  2126
    ].
fm@2327
  2127
    self withWaitCursorDo:[
cg@3286
  2128
        browser 
cg@3286
  2129
            askForMethodAndSpawnSearchTitle:'String to Search for in Sources:'
cg@3286
  2130
            browserLabel:'Methods containing "%1"'
cg@3286
  2131
            searchWith:#( #'findString:in:ignoreCase:match:' #'findString:inMethods:ignoreCase:match:' )
cg@3286
  2132
            searchWhat:#string
cg@3286
  2133
            searchArea:#currentPackage
cg@3286
  2134
            withCaseIgnore:false
cg@3286
  2135
            withTextEntry:false
cg@3286
  2136
            withMatch:true
cg@3286
  2137
            withMethodList:false
cg@3286
  2138
            setSearchPattern:[:brwsr :string :ignoreCase :doMatch|
cg@3286
  2139
                                brwsr autoSearchPattern:string ignoreCase:ignoreCase.
cg@3286
  2140
                             ]
cg@3286
  2141
            initialText:selectedKey "/ does not work: ('''*',selectedKey,'*''') check match!!               
fm@2327
  2142
    ].
cg@2015
  2143
! !
cg@2015
  2144
cg@2015
  2145
!InternationalLanguageTranslationEditor methodsFor:'menus dynamic'!
cg@2015
  2146
cg@2015
  2147
disableLanguageDisplayFor:lang
cg@2015
  2148
    self shownLanguages remove:lang ifAbsent:[]
cg@2015
  2149
!
cg@2015
  2150
cg@2015
  2151
enableLanguageDisplayFor:newLang
cg@2015
  2152
    |shownLanguagesInOrder|
cg@2015
  2153
cg@2015
  2154
    (self shownLanguages includes:newLang) ifFalse:[
cg@2048
  2155
"/        shownLanguagesInOrder := self languagesList
cg@2048
  2156
"/                                    select:[:lang | (self shownLanguages includes:lang)
cg@2048
  2157
"/                                                    or:[ lang = newLang ]].
cg@2048
  2158
"/        self shownLanguages contents:shownLanguagesInOrder.
cg@2434
  2159
	self shownLanguages add:newLang.
cg@2015
  2160
    ]
cg@2015
  2161
!
cg@2015
  2162
cg@2015
  2163
isLanguageShown:lang
cg@2015
  2164
    ^ self shownLanguages includes:lang
cg@2015
  2165
!
cg@2015
  2166
jan@3189
  2167
menuSliceTranslateGenerate
jan@3189
  2168
    | menu |
jan@3189
  2169
jan@3189
  2170
    menu := Menu new.
jan@3189
  2171
    keyStringsToLanguageMappings notNil ifTrue:[ 
jan@3189
  2172
        keyStringsToLanguageMappings languages do:[:lang | 
jan@3189
  2173
            menu addItem:   
jan@3189
  2174
                (MenuItem
jan@3189
  2175
                    label: (resources string: 'Generate Missing Translations - %1' with: lang asUppercase)
jan@3189
  2176
                    itemValue: [ self generateMissingTranslationsFor: (Array with: lang) ])
jan@3189
  2177
        ].
jan@3189
  2178
    ].
jan@3189
  2179
    ^ menu
jan@3189
  2180
jan@3189
  2181
    "Created: / 19-02-2015 / 12:44:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
jan@3189
  2182
!
jan@3189
  2183
cg@2015
  2184
shownLanguagesMenu
cg@2015
  2185
    <resource: #programMenu >
cg@2015
  2186
cg@2015
  2187
    ^ [
cg@2434
  2188
	|m selected|
cg@2434
  2189
cg@2434
  2190
	m := Menu new.
cg@2434
  2191
cg@2434
  2192
	self languagesList do:[:lang |
cg@2434
  2193
	    |item|
cg@2434
  2194
cg@2434
  2195
	    item := MenuItem label:lang.
cg@2434
  2196
	    item indication:(self languageShownHolderFor:lang).
cg@2434
  2197
	    item hideMenuOnActivated:false.
cg@2434
  2198
	    m addItem:item.
cg@2434
  2199
	].
cg@2434
  2200
	m
cg@2015
  2201
    ].
cg@2015
  2202
!
cg@2015
  2203
cg@2015
  2204
toggleLanguageDisplayFor:lang
cg@2015
  2205
    (self shownLanguages includes:lang) ifTrue:[
cg@2434
  2206
	self disableLanguageDisplayFor:lang
cg@2015
  2207
    ] ifFalse:[
cg@2434
  2208
	self enableLanguageDisplayFor:lang
cg@2015
  2209
    ].
cg@2015
  2210
! !
cg@2015
  2211
cg@2015
  2212
!InternationalLanguageTranslationEditor methodsFor:'private-key extraction'!
cg@2015
  2213
cg@2032
  2214
addAllTranslations:newTranslations
cg@3286
  2215
    "merge found xlations into the list of already present xlations"
cg@3286
  2216
    
cg@2034
  2217
    |newTranslationKeys stringKeys nonStringKeys|
cg@2032
  2218
sv@3245
  2219
    newTranslationKeys := newTranslations select:[:k | k notEmptyOrNil and:[k isString not or:[k isBlank not]]].
cg@2032
  2220
    newTranslationKeys := newTranslationKeys select:[:k | (keyStringsToLanguageMappings includesKey:k) not].
cg@3286
  2221
    "/ follow the common-xlations algrithm of ResourcePack
cg@3286
  2222
    "/ (which knows how to xlate strings with additional special chars.)
cg@3286
  2223
    newTranslationKeys := 
cg@3286
  2224
        newTranslationKeys collect:[:oldKey |
cg@3286
  2225
            |newKey methods|
cg@3286
  2226
            
cg@3286
  2227
            (oldKey endsWith:' ...') ifTrue:[
cg@3286
  2228
                newKey := oldKey copyButLast:4.
cg@3286
  2229
            ] ifFalse:[ (oldKey endsWith:'...') ifTrue:[
cg@3286
  2230
                newKey := oldKey copyButLast:3.
cg@3286
  2231
            ] ifFalse:[ ('\.:?=,!! ' includes:oldKey last) ifTrue:[
cg@3286
  2232
                newKey := oldKey copyButLast:1.
cg@3286
  2233
            ] ifFalse:[ ((oldKey first == $() and:[ oldKey last == $) ]) ifTrue:[
cg@3286
  2234
                newKey := oldKey copyFrom:2 to:oldKey size - 1
cg@3286
  2235
            ] ifFalse:[ ((oldKey first == $[) and:[ oldKey last == $] ]) ifTrue:[
cg@3286
  2236
                newKey := oldKey copyFrom:2 to:oldKey size - 1
cg@3286
  2237
            ] ifFalse:[
cg@3286
  2238
                newKey :=oldKey
cg@3286
  2239
            ]]]]].
cg@3286
  2240
            "/ must attach oldKey-methods to newKey
cg@3286
  2241
            methods := methodsUsingKey at:oldKey ifAbsent:nil.
cg@3286
  2242
            methods notNil ifTrue:[
cg@3286
  2243
                (methodsUsingKey at:newKey ifAbsentPut:[Set new]) addAll:methods
cg@3286
  2244
            ].    
cg@3286
  2245
            newKey
cg@3286
  2246
        ].
cg@3286
  2247
        
cg@2034
  2248
    newTranslationKeys := newTranslationKeys asSet.
sv@3246
  2249
    newTranslationKeys := newTranslationKeys select:[:k | (keyStringsToLanguageMappings includesKey:k) not].
cg@2034
  2250
cg@2032
  2251
    newTranslationKeys notEmpty ifTrue:[
cg@3077
  2252
        stringKeys := newTranslationKeys select:[:k | k isString].
cg@3077
  2253
        nonStringKeys := newTranslationKeys select:[:k | k isString not].
cg@3077
  2254
cg@3077
  2255
        stringKeys := stringKeys asSortedCollection.
cg@3077
  2256
        keyStringsToLanguageMappings addKeys:stringKeys.
cg@3077
  2257
        keyStringsToLanguageMappings addKeys:nonStringKeys.
cg@3077
  2258
        modified := true.
cg@2032
  2259
    ].
cg@2032
  2260
!
cg@2032
  2261
cg@2032
  2262
extractTranslationsFromClass:aClass
cg@2032
  2263
    |newTranslations|
cg@2032
  2264
cg@2032
  2265
    newTranslations := Set new.
cg@2032
  2266
cg@2032
  2267
    self withWaitCursorDo:[
sv@3248
  2268
        "/ now, the hard part:
sv@3248
  2269
        "/ possible translations are in the specs,
sv@3248
  2270
        "/ and all arguments to (resources string:) messages.
sv@3248
  2271
        aClass instAndClassMethodsDo:[:eachMethod |
sv@3248
  2272
            newTranslations addAll:( self extractTranslationsFromMethod:eachMethod ).
sv@3248
  2273
        ].
sv@3248
  2274
    ].
cg@3286
  2275
    
cg@3286
  2276
    newTranslations := 
cg@3286
  2277
        newTranslations select:[:eachTranslation|
cg@3286
  2278
            (aClass resources at:eachTranslation ifAbsent:nil) isNil
cg@3286
  2279
        ].
cg@2032
  2280
    ^ newTranslations
cg@2032
  2281
!
cg@2032
  2282
cg@2015
  2283
extractTranslationsFromHelpSpecMethod:aMethod
cg@3286
  2284
    "return strings which need translation from a help-spec method"
cg@3286
  2285
cg@2015
  2286
    |codeStrings matcher parseTree resourceKeys|
cg@2015
  2287
cg@2434
  2288
    parseTree := RBParser
sv@3245
  2289
            parseMethod:aMethod source
sv@3245
  2290
            onError: [:str :pos | Transcript showCR:str. Transcript showCR:pos.
sv@3245
  2291
                                  nil].
cg@2015
  2292
    parseTree isNil ifTrue:[^ #() ].
cg@2015
  2293
cg@2434
  2294
    codeStrings  :=
sv@3245
  2295
        #(
sv@3245
  2296
                '`@dict addPairsFrom: `#helpKeysAndStrings'
cg@3283
  2297
                '^ `#lit'
sv@3245
  2298
        ).
cg@2015
  2299
cg@2015
  2300
    resourceKeys := Set new.
cg@2015
  2301
cg@2015
  2302
    matcher := ParseTreeSearcher new.
cg@2434
  2303
    matcher
sv@3245
  2304
        matchesAnyOf: codeStrings
sv@3245
  2305
        do: [:aNode :answer |
sv@3245
  2306
                |sel argNode arg|
sv@3245
  2307
cg@3283
  2308
                aNode isReturn ifTrue:[
cg@3283
  2309
                    "/ a ^ #(...)
cg@3283
  2310
                    aNode value isLiteralArray ifTrue:[
cg@3283
  2311
                        aNode value value pairWiseDo:[:helpKey :helpString |
cg@3286
  2312
                            self rememberMethod:aMethod usingKey:helpString.
cg@3283
  2313
                            resourceKeys add:helpString.
cg@3283
  2314
                        ].
cg@3283
  2315
                    ].    
cg@3283
  2316
                ] ifFalse:[    
cg@3283
  2317
                    sel := aNode selector.
cg@3283
  2318
                    (sel startsWith:'addPairsFrom:') ifTrue:[
cg@3283
  2319
                        argNode := aNode arguments at:1.
cg@3286
  2320
                        argNode isLiteralArray ifTrue:[
cg@3283
  2321
                            arg := argNode value.
cg@3286
  2322
                            arg doWithIndex:[:el :index |
cg@3286
  2323
                                index even ifTrue:[
cg@3286
  2324
                                    el isString ifTrue:[
cg@3286
  2325
                                        self rememberMethod:aMethod usingKey:el.
cg@3286
  2326
                                        resourceKeys add:el.
cg@3286
  2327
                                    ]
sv@3245
  2328
                                ].
sv@3245
  2329
                            ].
sv@3245
  2330
                        ] ifFalse:[
cg@3283
  2331
                            Transcript halt
sv@3245
  2332
                                showCR:(resources
cg@3286
  2333
                                            string:'Cannot derive resourceKey from non-literal array: %1 in %2'
cg@3283
  2334
                                            with:argNode formattedCode
cg@3283
  2335
                                            with:aMethod selector).
sv@3245
  2336
                        ].
sv@3245
  2337
                    ].
sv@3245
  2338
                ].
sv@3245
  2339
                aNode
sv@3245
  2340
            ].
cg@2015
  2341
cg@2015
  2342
    matcher executeTree: parseTree initialAnswer: nil.
cg@2015
  2343
    ^ resourceKeys
cg@2015
  2344
!
cg@2015
  2345
cg@2015
  2346
extractTranslationsFromMenuSpecMethod:aMethod
cg@3286
  2347
    "return strings which need translation from a menu-spec method"
cg@3286
  2348
cg@2015
  2349
    |menu resourceKeys|
cg@2015
  2350
cg@2015
  2351
    menu := aMethod mclass theNonMetaclass perform:aMethod selector.
cg@2015
  2352
    menu isNil ifTrue:[ ^ #() ].
cg@2015
  2353
cg@2015
  2354
    (menu isKindOf:Menu) ifFalse:[
sv@3248
  2355
        menu := Menu new fromLiteralArrayEncoding:menu
cg@2015
  2356
    ].
cg@2015
  2357
cg@2015
  2358
    resourceKeys := Set new.
cg@2015
  2359
    menu allItemsDo:[:aMenuItem |
sv@3248
  2360
        aMenuItem translateLabel ifTrue:[
sv@3248
  2361
            (aMenuItem isSeparatorItem or:[aMenuItem isMenuSlice])  ifFalse:[
cg@3286
  2362
                self rememberMethod:aMethod usingKey:aMenuItem label.
sv@3248
  2363
                resourceKeys add:aMenuItem label.
sv@3248
  2364
            ]
sv@3248
  2365
        ]
cg@2015
  2366
    ].
cg@2015
  2367
    ^ resourceKeys
cg@2015
  2368
!
cg@2015
  2369
cg@2015
  2370
extractTranslationsFromMethod:aMethod
cg@3286
  2371
    "return strings which need translation from a method."
cg@3286
  2372
    
cg@2015
  2373
    |mResources|
cg@2015
  2374
cg@2015
  2375
    mResources := aMethod resources.
cg@2015
  2376
    mResources notNil ifTrue:[
cg@3283
  2377
        (mResources includesKey:#menu) ifTrue:[
cg@3283
  2378
             ^ self extractTranslationsFromMenuSpecMethod:aMethod.
cg@3283
  2379
        ].
cg@3283
  2380
        (mResources includesKey:#canvas) ifTrue:[
cg@3283
  2381
             ^ self extractTranslationsFromUISpecMethod:aMethod.
cg@3283
  2382
        ].
cg@3283
  2383
        (mResources includesKey:#help) ifTrue:[
cg@3283
  2384
             ^ self extractTranslationsFromHelpSpecMethod:aMethod.
cg@3283
  2385
        ].
cg@3283
  2386
        (mResources includesKey:#tableColumns) ifTrue:[
cg@3283
  2387
             ^ self extractTranslationsFromTableColumnsSpecMethod:aMethod.
cg@3283
  2388
        ].
cg@3283
  2389
cg@3283
  2390
        ^ self extractTranslationsFromSpecMethod:aMethod.
cg@2015
  2391
    ].
cg@2015
  2392
    ^ self extractTranslationsFromMethodsCode:aMethod
cg@2015
  2393
!
cg@2015
  2394
cg@2015
  2395
extractTranslationsFromMethodsCode:aMethod
cg@3286
  2396
    "return strings which need translation from a normal method.
cg@3286
  2397
     detects messages to the resource translation mechanism"
cg@3286
  2398
cg@2015
  2399
    |codeStrings matcher parseTree resourceKeys|
cg@2015
  2400
cg@2434
  2401
    parseTree := RBParser
jan@3189
  2402
            parseMethod:aMethod source
jan@3189
  2403
            onError: [:str :pos | Transcript showCR:str. Transcript showCR:pos.
jan@3189
  2404
                                  nil].
cg@2015
  2405
    parseTree isNil ifTrue:[^ #() ].
cg@2015
  2406
cg@2434
  2407
    codeStrings  :=
jan@3189
  2408
        #(
jan@3189
  2409
                'resources `@msg: `@args'
jan@3189
  2410
                'self resources `@msg: `@args'
jan@3189
  2411
                'self class resources `@msg: `@args'
cg@3284
  2412
                'self class classResources `@msg: `@args'
jan@3189
  2413
                'self classResources `@msg: `@args'
sv@3245
  2414
                '`V classResources `@msg: `@args'
jan@3189
  2415
        ).
cg@2015
  2416
cg@2015
  2417
    resourceKeys := Set new.
cg@2015
  2418
cg@2015
  2419
    matcher := ParseTreeSearcher new.
cg@2434
  2420
    matcher
jan@3189
  2421
        matchesAnyOf: codeStrings
jan@3189
  2422
        do: [:aNode :answer |
jan@3189
  2423
                |sel keyStringArgNode keyStringArg|
jan@3189
  2424
jan@3189
  2425
                sel := aNode selector.
jan@3189
  2426
                ((sel startsWith:'string:') or:[(sel startsWith:'at:') or:[sel startsWith:'stringWithCRs:']]) ifTrue:[
jan@3189
  2427
                    keyStringArgNode := aNode arguments at:1.
cg@3284
  2428
                    (keyStringArg := self literalStringOrStringConcatenation:keyStringArgNode) notNil ifTrue:[
cg@3286
  2429
                        self rememberMethod:aMethod usingKey:keyStringArg.
cg@3284
  2430
                        resourceKeys add:keyStringArg.
jan@3189
  2431
                    ] ifFalse:[
jan@3189
  2432
                        Transcript
cg@3284
  2433
                            showCR:(resources
cg@3284
  2434
                                    string:'[LanguageTranslator] warning: Cannot derive resourceKey from non-string: %1 in %2'
cg@3284
  2435
                                    with:keyStringArgNode formattedCode
cg@3284
  2436
                                    with:aMethod whoString).
jan@3189
  2437
                    ].
jan@3189
  2438
                ].
jan@3189
  2439
                aNode
jan@3189
  2440
            ].
cg@2015
  2441
cg@2015
  2442
    matcher executeTree: parseTree initialAnswer: nil.
cg@2015
  2443
    ^ resourceKeys
jan@3189
  2444
jan@3189
  2445
    "Modified: / 19-02-2015 / 11:42:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
cg@2015
  2446
!
cg@2015
  2447
cg@2015
  2448
extractTranslationsFromSpecMethod:aMethod
cg@2015
  2449
    ^ #()
cg@2015
  2450
!
cg@2015
  2451
cg@2015
  2452
extractTranslationsFromTableColumnsSpecMethod:aMethod
cg@3286
  2453
    "return strings which need translation from a table-spec method"
cg@3286
  2454
cg@2015
  2455
    |columnDescription resourceKeys|
cg@2015
  2456
cg@2015
  2457
    columnDescription := aMethod mclass theNonMetaclass perform:aMethod selector.
cg@2015
  2458
    columnDescription isNil ifTrue:[ ^ #() ].
cg@2015
  2459
cg@2015
  2460
    (columnDescription first isKindOf:DataSetColumnSpec) ifFalse:[
cg@3286
  2461
        columnDescription := columnDescription collect:[:el | DataSetColumnSpec new fromLiteralArrayEncoding:el].
cg@2015
  2462
    ].
cg@2015
  2463
cg@2015
  2464
    resourceKeys := Set new.
cg@2015
  2465
    columnDescription do:[:aColumnSpec |
cg@3286
  2466
        aColumnSpec translateLabel ifTrue:[
cg@3286
  2467
            self rememberMethod:aMethod usingKey:aColumnSpec label.
cg@3286
  2468
            resourceKeys add:aColumnSpec label.
cg@3286
  2469
        ]
cg@2015
  2470
    ].
cg@2015
  2471
    ^ resourceKeys
cg@2015
  2472
!
cg@2015
  2473
cg@2015
  2474
extractTranslationsFromUISpecMethod:aMethod
cg@3286
  2475
    "return strings which need translation from a UI-spec method"
cg@3286
  2476
    
cg@2015
  2477
    |spec resourceKeys visitor|
cg@2015
  2478
cg@2015
  2479
    spec := aMethod mclass theNonMetaclass perform:aMethod selector.
cg@2015
  2480
    spec isNil ifTrue:[ ^ #() ].
cg@2015
  2481
cg@2015
  2482
    (spec isKindOf:UISpecification) ifFalse:[
cg@3286
  2483
        spec := UISpecification from:spec
cg@2015
  2484
    ].
cg@2015
  2485
cg@2015
  2486
    resourceKeys := Set new.
cg@2015
  2487
cg@2015
  2488
    visitor := UISpecVisitor new.
cg@2015
  2489
    spec acceptVisitor:visitor.
cg@3286
  2490
    visitor translatedLabels do:[:each |
cg@3286
  2491
        self rememberMethod:aMethod usingKey:each.
cg@3286
  2492
    ].
cg@2015
  2493
    ^ visitor translatedLabels
cg@3284
  2494
!
cg@3284
  2495
cg@3284
  2496
literalStringOrStringConcatenation:aParseNode
cg@3284
  2497
    "nil if not a literal or a string concatenation"
cg@3284
  2498
    
cg@3284
  2499
    aParseNode isLiteralString ifTrue:[^ aParseNode value].
cg@3284
  2500
    (aParseNode isMessage and:[aParseNode selector == #,]) ifTrue:[
cg@3284
  2501
        |leftString rightString|
cg@3284
  2502
        
cg@3284
  2503
        aParseNode receiver isLiteralString ifTrue:[
cg@3284
  2504
            leftString := aParseNode receiver value
cg@3284
  2505
        ] ifFalse:[
cg@3284
  2506
            leftString := self literalStringOrStringConcatenation:aParseNode receiver.
cg@3284
  2507
        ].
cg@3284
  2508
        aParseNode arguments first isLiteralString ifTrue:[
cg@3284
  2509
            rightString := aParseNode arguments first value
cg@3284
  2510
        ] ifFalse:[
cg@3284
  2511
            rightString := self literalStringOrStringConcatenation:aParseNode arguments first.
cg@3284
  2512
        ].
cg@3284
  2513
        (leftString notNil and:[rightString notNil]) ifTrue:[
cg@3284
  2514
            ^ leftString , rightString
cg@3284
  2515
        ].
cg@3284
  2516
    ].
cg@3284
  2517
    ^ nil
cg@3286
  2518
!
cg@3286
  2519
cg@3286
  2520
recordNewTranslation:aString
cg@3286
  2521
    "called from recorder, when the monitored application does a translation"
cg@3286
  2522
    
cg@3286
  2523
    self addAllTranslations:{ aString }
cg@3286
  2524
!
cg@3286
  2525
cg@3286
  2526
rememberMethod:aMethod usingKey:aKey
cg@3286
  2527
    (methodsUsingKey at:aKey ifAbsentPut:[Set new]) add:aMethod
cg@2015
  2528
! !
cg@2015
  2529
cg@2015
  2530
!InternationalLanguageTranslationEditor methodsFor:'queries'!
cg@2015
  2531
cg@2434
  2532
autoAccept
fm@2050
  2533
fm@2050
  2534
    ^ self autoAcceptHolder value
fm@2050
  2535
!
fm@2050
  2536
cg@2434
  2537
currentExampleLanguageText
fm@2050
  2538
   "Returns the language text corresponding for the current selected key and the example language selection"
fm@2050
  2539
fm@2050
  2540
  ^self languageTextFromSelectedKeyFor: self exampleLanguageSelectionHolder value
fm@2050
  2541
!
fm@2050
  2542
fm@2051
  2543
currentLanguage
fm@2051
  2544
fm@2163
  2545
    |colSelectionIndex |
fm@2051
  2546
fm@2051
  2547
    colSelectionIndex := dataSetView selectedColIndex.
fm@2051
  2548
    ^colSelectionIndex > 1 ifTrue:[ shownLanguages at:colSelectionIndex-1 ] ifFalse:nil.
fm@2051
  2549
!
fm@2051
  2550
fm@2050
  2551
exampleLanguageByDefault
fm@2050
  2552
fm@2163
  2553
    ^self shownLanguages isEmpty
cg@2434
  2554
	ifTrue:[nil]
cg@2434
  2555
	ifFalse:[self shownLanguages first]
fm@2050
  2556
!
fm@2050
  2557
fm@2051
  2558
hasFirstRowSelection
fm@2051
  2559
    self selectedKeyRow isNil ifTrue:[^false].
fm@2051
  2560
    ^ self selectedKeyRow value > 1
fm@2051
  2561
!
fm@2051
  2562
fm@2051
  2563
hasLanguageSelection
fm@2051
  2564
    dataSetView selectedColIndex isNil ifTrue:[^false].
fm@2051
  2565
    ^ dataSetView selectedColIndex > 1
fm@2051
  2566
!
fm@2051
  2567
cg@2015
  2568
hasUnsavedChanges
cg@2015
  2569
    ^ modified
fm@2050
  2570
!
fm@2050
  2571
fm@2163
  2572
includesKey: aKey
fm@2163
  2573
    keyStringsToLanguageMappings isNil ifTrue:[^false].
fm@2163
  2574
    ^keyStringsToLanguageMappings includesKey:aKey
fm@2163
  2575
!
fm@2163
  2576
fm@2051
  2577
isSearchForSimilarTranslationEnabled
fm@2051
  2578
fm@2163
  2579
    ^self searchForSimilarTranslationEnableHolder value
fm@2051
  2580
!
fm@2051
  2581
fm@2051
  2582
languageTextFromKey: aKeyIndex for: language
cg@2434
  2583
    "Returns the language text corresponding for the aKeyIndex and the received language"
fm@2051
  2584
fm@2051
  2585
    language isNil ifTrue:[^''].
cg@2434
  2586
    ^keyStringsToLanguageMappings at: aKeyIndex language:language.
fm@2051
  2587
!
fm@2051
  2588
fm@2050
  2589
languageTextFromSelectedKeyFor: language
cg@2434
  2590
    "Returns the language text corresponding for the current selected key and the received language"
cg@2434
  2591
cg@2434
  2592
    ^self languageTextFromKey: self selectedKey for: language
fm@2051
  2593
!
fm@2051
  2594
fm@2051
  2595
shouldCopyPreviousTranslationButtonBeEnabled
cg@2434
  2596
    ^ self hasLanguageSelection
cg@2434
  2597
	and:[self hasFirstRowSelection]
fm@2051
  2598
!
fm@2051
  2599
fm@2323
  2600
shouldPasteOriginalButtonBeEnabled
cg@2434
  2601
    ^ self hasLanguageSelection