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