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