Tools__InternationalLanguageTranslationEditor.st
author mawalch
Tue, 13 Jun 2017 17:30:31 +0200
changeset 3448 e4a15fd6bec5
parent 3447 e82292ff5869
child 3454 5488b2613628
permissions -rw-r--r--
#REFACTORING by mawalch
class: Tools::InternationalLanguageTranslationEditor class
changed: #keyStringAndLanguageSelectionTableMenu

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