Tools__InternationalLanguageTranslationEditor.st
author Claus Gittinger <cg@exept.de>
Wed, 29 Jul 2009 20:02:02 +0200
changeset 2570 4e663bc64364
parent 2434 6ad1f853d2e9
child 2880 263e41303b0a
permissions -rw-r--r--
changed #requestPackage
     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      MenuEditor new openOnClass:Tools::InternationalLanguageTranslationEditor andSelector:#menuToolBar
   878      (Menu new fromLiteralArrayEncoding:(Tools::InternationalLanguageTranslationEditor menuToolBar)) startUp
   879     "
   880 
   881     <resource: #menu>
   882 
   883     ^
   884      #(Menu
   885 	(
   886 	 (MenuItem
   887 	    label: 'Save'
   888 	    itemValue: menuSave
   889 	    translateLabel: true
   890 	    labelImage: (ResourceRetriever XPToolbarIconLibrary saveImageIcon)
   891 	  )
   892 	 (MenuItem
   893 	    label: '-'
   894 	  )
   895 	 (MenuItem
   896 	    label: 'Add Translation'
   897 	    itemValue: addTranslation
   898 	    translateLabel: true
   899 	    labelImage: (ResourceRetriever XPToolbarIconLibrary newRowIcon)
   900 	  )
   901 	 (MenuItem
   902 	    label: 'Remove Translation'
   903 	    itemValue: removeTranslation
   904 	    translateLabel: true
   905 	    labelImage: (ResourceRetriever XPToolbarIconLibrary removeRowIcon)
   906 	  )
   907 	 (MenuItem
   908 	    label: '-'
   909 	  )
   910 	 (MenuItem
   911 	    label: 'Search'
   912 	    itemValue: search
   913 	    translateLabel: true
   914 	    shortcutKey: Ctrlf
   915 	    labelImage: (ResourceRetriever #'Tools::InternationalLanguageTranslationEditor' searchToolBarIcon)
   916 	  )
   917 	 (MenuItem
   918 	    label: ''
   919 	  )
   920 	 (MenuItem
   921 	    label: 'Stop Application'
   922 	    itemValue: stopApplication
   923 	    translateLabel: true
   924 	    isVisible: stopApplicationIconVisibleHolder
   925 	    labelImage: (ResourceRetriever XPToolbarIconLibrary stop16x16Icon)
   926 	  )
   927 	 )
   928 	nil
   929 	nil
   930       )
   931 ! !
   932 
   933 !InternationalLanguageTranslationEditor class methodsFor:'startup'!
   934 
   935 openOnFile:aFilename
   936     |fn|
   937 
   938     fn := aFilename asFilename.
   939 
   940     self new
   941 	allButOpen;
   942 	readResourceFile:fn asLanguage:fn withoutSuffix baseName;
   943 	openWindow.
   944 ! !
   945 
   946 !InternationalLanguageTranslationEditor class methodsFor:'tableColumns specs'!
   947 
   948 keyTableColumn
   949     "This resource specification was automatically generated
   950      by the DataSetBuilder of ST/X."
   951 
   952     "Do not manually edit this!! If it is corrupted,
   953      the DataSetBuilder may not be able to read the specification."
   954 
   955     "
   956      DataSetBuilder new openOnClass:Tools::InternationalLanguageTranslationEditor andSelector:#keyTableColumn
   957     "
   958 
   959     <resource: #tableColumns>
   960 
   961     ^#(
   962       (DataSetColumnSpec
   963 	 label: 'Key'
   964 	 labelButtonType: Button
   965 	 minWidth: 50
   966 	 model: keyStringInRow:
   967        )
   968       )
   969 !
   970 
   971 languageTableColumn
   972     "This resource specification was automatically generated
   973      by the DataSetBuilder of ST/X."
   974 
   975     "Do not manually edit this!! If it is corrupted,
   976      the DataSetBuilder may not be able to read the specification."
   977 
   978     "
   979      DataSetBuilder new openOnClass:Tools::InternationalLanguageTranslationEditor andSelector:#languageTableColumn
   980     "
   981 
   982     <resource: #tableColumns>
   983 
   984     ^#(
   985       (DataSetColumnSpec
   986 	 label: lang
   987 	 labelButtonType: Button
   988 	 minWidth: 50
   989 	 editorType: None
   990 	 model: columnInRow:at:
   991 	 backgroundSelector: getBackgroundForRow:rowNr:col:
   992        )
   993       )
   994 ! !
   995 
   996 !InternationalLanguageTranslationEditor methodsFor:'accessing'!
   997 
   998 currentSelectionIndex
   999 
  1000     ^ self selectedKeyRow value
  1001 
  1002     "Created: / 16-06-2007 / 09:04:11 / Administrador"
  1003     "Modified: / 19-06-2007 / 17:28:38 / Administrador"
  1004 !
  1005 
  1006 exists: anObject
  1007 
  1008     ^self objectsList includes: anObject
  1009 
  1010     "Created: / 19-06-2007 / 16:42:22 / Administrador"
  1011 !
  1012 
  1013 indexOf: anObject
  1014 
  1015     ^self objectsList indexOf: anObject
  1016 
  1017     "Created: / 19-06-2007 / 16:39:44 / Administrador"
  1018 !
  1019 
  1020 newLanguageText
  1021 "/   languageEditor accept
  1022     ^self languageTextHolder value isNil
  1023 	ifTrue:['']
  1024 	ifFalse:[self languageTextHolder value asCollectionOfLines first.]
  1025 !
  1026 
  1027 objectsList
  1028 
  1029     ^ keyStringsToLanguageMappings
  1030 !
  1031 
  1032 selectListIndex: rowIndex
  1033 "/    |selection list|
  1034 "/    list := self objectsList.
  1035 "/    list isEmpty ifTrue:[^self].
  1036 "/    selection := list at:rowIndex ifAbsent:nil.
  1037     self selectedKeyRow value: rowIndex.
  1038 
  1039     "Created: / 16-06-2007 / 09:06:46 / Administrador"
  1040     "Modified: / 22-06-2007 / 13:45:54 / Administrador"
  1041 !
  1042 
  1043 selectedKey
  1044    "Returns the current selected key if there is one row seleted. Otherwise, returns nil"
  1045      |rowSelectionIndex |
  1046 
  1047     keyStringsToLanguageMappings isNil ifTrue:[^nil].
  1048     self selectedKeyRow value isNil ifTrue:[^nil].
  1049     rowSelectionIndex := self selectedKeyRow value.
  1050     rowSelectionIndex == 0 ifTrue:[^nil].
  1051     ^ keyStringsToLanguageMappings keyAt:rowSelectionIndex.
  1052 !
  1053 
  1054 tableView
  1055 
  1056     ^dataSetView scrolledView
  1057 
  1058     "Created: / 15-06-2007 / 18:59:51 / Administrador"
  1059 ! !
  1060 
  1061 !InternationalLanguageTranslationEditor methodsFor:'additionalFuncionalities'!
  1062 
  1063 searchForSimilarTranslation
  1064     "Looks for a quite similar translation for the key and display a dialog with available options"
  1065     |similarTranslationsAssociations selectedTranslation key|
  1066 
  1067     self shouldSearchForSimilarTranslation ifFalse:[^self].
  1068 
  1069     key := self selectedKey.
  1070     key isNil ifTrue:[^ self.].
  1071     similarTranslationsAssociations := keyStringsToLanguageMappings searchForSimilarTranslation: key in: self currentLanguage.
  1072     similarTranslationsAssociations isEmpty ifTrue:[^self].
  1073 
  1074     similarTranslationsAssociations := similarTranslationsAssociations associations inject: OrderedCollection new into:[:collection :association |
  1075 	collection detect:[:selectedAssociation |
  1076 	    selectedAssociation value sameAs: association value] ifNone:[collection add: association].
  1077 	collection].
  1078     selectedTranslation := Dialog
  1079 	choose:'Choose one if you consider it´s usefull to translate:
  1080     ',
  1081 	'<', key, '>  ', (self currentExampleLanguageText ifNil:[''])
  1082 	fromList: (similarTranslationsAssociations collect:[:each |  '<', each key, '>  ', each value])
  1083 	values: (similarTranslationsAssociations collect:[:each | each value])
  1084 	lines:10
  1085 	cancel: nil.
  1086 
  1087     selectedTranslation notNil ifTrue:[self languageTextHolderValue: selectedTranslation].
  1088 ! !
  1089 
  1090 !InternationalLanguageTranslationEditor methodsFor:'aspects'!
  1091 
  1092 alwaysWriteUTF8Holder
  1093     alwaysWriteUTF8Holder isNil ifTrue:[alwaysWriteUTF8Holder := true asValue].
  1094     ^ alwaysWriteUTF8Holder
  1095 !
  1096 
  1097 autoAcceptHolder
  1098     autoAcceptHolder isNil ifTrue:[autoAcceptHolder := true asValue].
  1099     ^ autoAcceptHolder
  1100 !
  1101 
  1102 exampleLanguageSelectionHolder
  1103     exampleLanguageSelectionHolder isNil ifTrue:[
  1104 	exampleLanguageSelectionHolder := self exampleLanguageByDefault asValue.
  1105 	exampleLanguageSelectionHolder addDependent:self.
  1106     ].
  1107     ^ exampleLanguageSelectionHolder
  1108 !
  1109 
  1110 exampleLanguageTextHolder
  1111     exampleLanguageTextHolder isNil ifTrue:[
  1112 	exampleLanguageTextHolder := '' asValue.
  1113     ].
  1114     ^ exampleLanguageTextHolder.
  1115 !
  1116 
  1117 ignoreCaseHolder
  1118 
  1119     ignoreCaseHolder isNil ifTrue:[
  1120 	ignoreCaseHolder := false asValue.
  1121 "/ if your app needs to be notified of changes, uncomment one of the lines below:
  1122 "/       ignoreCaseHolder addDependent:self.
  1123 	ignoreCaseHolder onChangeSend:#ignoreCaseHolderChanged to:self.
  1124 
  1125     ].
  1126     ^ ignoreCaseHolder.
  1127 
  1128     "Created: / 16-06-2007 / 06:45:04 / Administrador"
  1129     "Modified: / 16-06-2007 / 19:32:15 / Administrador"
  1130 !
  1131 
  1132 keyStringAndLanguageSelectionTable
  1133     keyStringsToLanguageMappings isNil ifTrue:[
  1134 	keyStringsToLanguageMappings := KeyStringsToLanguageMappings new.
  1135     ].
  1136     ^ keyStringsToLanguageMappings.
  1137 !
  1138 
  1139 keyStringAndLanguageSelectionTableColumnDescriptionHolder
  1140     keyStringAndLanguageSelectionTableColumnDescriptionHolder isNil ifTrue:[
  1141 	keyStringAndLanguageSelectionTableColumnDescriptionHolder := ValueHolder new.
  1142 	keyStringAndLanguageSelectionTableColumnDescriptionHolder value:(self keyStringAndLanguageSelectionTableColumnDescription).
  1143     ].
  1144     ^ keyStringAndLanguageSelectionTableColumnDescriptionHolder.
  1145 !
  1146 
  1147 languageAtCol:colNr
  1148     ^ shownLanguages at:colNr-1.
  1149 !
  1150 
  1151 languageShownHolderFor:lang
  1152     |holder|
  1153 
  1154     languageShownHolders isNil ifTrue:[
  1155 	languageShownHolders := Dictionary new
  1156     ].
  1157     holder := languageShownHolders
  1158 		at:lang
  1159 		ifAbsentPut:[
  1160 		    |h|
  1161 
  1162 		    h := true asValue.
  1163 		    h onChangeEvaluate:[
  1164 			h value ifTrue:[
  1165 			   self enableLanguageDisplayFor:lang
  1166 			] ifFalse:[
  1167 			   self disableLanguageDisplayFor:lang
  1168 			].
  1169 		    ].
  1170 		    h
  1171 		].
  1172     ^ holder.
  1173 !
  1174 
  1175 languageTextAcceptHolder
  1176     languageTextAcceptHolder isNil ifTrue:[
  1177 	languageTextAcceptHolder := false asValue.
  1178     ].
  1179     ^ languageTextAcceptHolder.
  1180 !
  1181 
  1182 languageTextHolder
  1183     languageTextHolder isNil ifTrue:[
  1184 	languageTextHolder := '' asValue.
  1185     ].
  1186     ^ languageTextHolder.
  1187 !
  1188 
  1189 languageTextModifiedHolder
  1190     languageTextModifiedHolder isNil ifTrue:[
  1191 	languageTextModifiedHolder := false asValue.
  1192     ].
  1193     ^ languageTextModifiedHolder.
  1194 !
  1195 
  1196 languagesList
  1197     languagesList isNil ifTrue:[
  1198 	languagesList := List withAll:(self keyStringAndLanguageSelectionTable languages).
  1199     ].
  1200     ^ languagesList.
  1201 !
  1202 
  1203 originalTextHolder
  1204     originalTextHolder isNil ifTrue:[
  1205 	originalTextHolder := '' asValue.
  1206     ].
  1207     ^ originalTextHolder.
  1208 !
  1209 
  1210 originalTextModifiedHolder
  1211     originalTextModifiedHolder isNil ifTrue:[
  1212 	originalTextModifiedHolder := false asValue.
  1213     ].
  1214     ^ originalTextModifiedHolder.
  1215 !
  1216 
  1217 pasteOriginalEnableHolder
  1218    pasteOriginalEnableHolder isNil ifTrue:[pasteOriginalEnableHolder := false asValue].
  1219     ^ pasteOriginalEnableHolder
  1220 !
  1221 
  1222 pastePreviousTranslationEnableHolder
  1223    pastePreviousTranslationEnableHolder isNil ifTrue:[pastePreviousTranslationEnableHolder := false asValue].
  1224     ^ pastePreviousTranslationEnableHolder
  1225 !
  1226 
  1227 searchBarImageInfoLabelHolder
  1228 
  1229     searchBarImageInfoLabelHolder isNil ifTrue:[
  1230 	searchBarImageInfoLabelHolder := nil asValue .
  1231     ].
  1232     ^ searchBarImageInfoLabelHolder.
  1233 
  1234     "Created: / 16-06-2007 / 10:06:28 / Administrador"
  1235 !
  1236 
  1237 searchBarInfoLabelHolder
  1238 
  1239     searchBarInfoLabelHolder isNil ifTrue:[
  1240 	searchBarInfoLabelHolder := '' asValue .
  1241     ].
  1242     ^ searchBarInfoLabelHolder.
  1243 
  1244     "Created: / 16-06-2007 / 06:20:49 / Administrador"
  1245 !
  1246 
  1247 searchBoxVisible
  1248 
  1249     searchBoxVisible isNil ifTrue:[
  1250 	searchBoxVisible := false asValue.
  1251     ].
  1252     ^ searchBoxVisible.
  1253 
  1254     "Created: / 15-06-2007 / 18:15:52 / Administrador"
  1255 !
  1256 
  1257 searchForSimilarTranslationEnableHolder
  1258    searchForSimilarTranslationEnableHolder isNil
  1259 	ifTrue:[searchForSimilarTranslationEnableHolder := true asValue].
  1260     ^ searchForSimilarTranslationEnableHolder
  1261 !
  1262 
  1263 searchTextHolder
  1264 
  1265     searchTextHolder isNil ifTrue:[
  1266 	searchTextHolder := ValueHolder new.
  1267 "/ if your app needs to be notified of changes, uncomment one of the lines below:
  1268 "/       userSelectedHolder addDependent:self.
  1269 "/       userSelectedHolder onChangeSend:#searchTextHolderChanged to:self.
  1270     ].
  1271     ^ searchTextHolder.
  1272 
  1273     "Created: / 15-06-2007 / 18:06:08 / Administrador"
  1274 !
  1275 
  1276 searchTextModifiedHolder
  1277 
  1278     searchTextModifiedHolder isNil ifTrue:[
  1279 	searchTextModifiedHolder := false asValue .
  1280 "/ if your app needs to be notified of changes, uncomment one of the lines below:
  1281 "/       searchTextModifiedHolder addDependent:self.
  1282        searchTextModifiedHolder onChangeSend:#searchTextModifiedHolderChanged to:self.
  1283     ].
  1284     ^ searchTextModifiedHolder.
  1285 
  1286     "Created: / 15-06-2007 / 18:07:19 / Administrador"
  1287 !
  1288 
  1289 selectedKeyRow
  1290     selectedKeyRow isNil ifTrue:[
  1291 	selectedKeyRow := ValueHolder new.
  1292 	selectedKeyRow onChangeSend:#selectionChanged to:self.
  1293     ].
  1294     ^ selectedKeyRow.
  1295 !
  1296 
  1297 showMissingTranslationsOnly
  1298     showMissingTranslationsOnly isNil ifTrue:[
  1299 	showMissingTranslationsOnly := false asValue.
  1300 	showMissingTranslationsOnly onChangeSend:#showMissingTranslationsOnlyChanged to:self.
  1301     ].
  1302     ^ showMissingTranslationsOnly.
  1303 !
  1304 
  1305 shownLanguages
  1306     shownLanguages isNil ifTrue:[
  1307 	shownLanguages := List new.
  1308 	shownLanguages addAll:(self languagesList).
  1309 	shownLanguages onChangeSend:#shownLanguagesChanged to:self.
  1310     ].
  1311     ^ shownLanguages.
  1312 !
  1313 
  1314 stopApplicationIconVisibleHolder
  1315     stopApplicationIconVisibleHolder isNil ifTrue:[
  1316 	stopApplicationIconVisibleHolder := false asValue.
  1317     ].
  1318     ^ stopApplicationIconVisibleHolder.
  1319 ! !
  1320 
  1321 !InternationalLanguageTranslationEditor methodsFor:'change & update'!
  1322 
  1323 languageTextHolderValue: aString
  1324 
  1325     self languageTextHolder value: aString.
  1326     self languageTextModifiedHolder value:true.
  1327 !
  1328 
  1329 update:something with:aParameter from:changedObject
  1330     changedObject == shownLanguages ifTrue:[
  1331 	 self shownLanguagesChanged.
  1332 	 ^ self.
  1333     ].
  1334     changedObject == languageTextAcceptHolder ifTrue:[
  1335 	 self updateLanguageTextModification.
  1336 	 ^ self.
  1337     ].
  1338     changedObject == exampleLanguageSelectionHolder ifTrue:[
  1339 	self updateExampleLanguageText.
  1340 	^ self.
  1341     ].
  1342     changedObject == showMissingTranslationsOnly ifTrue:[
  1343 	self showMissingTranslationsOnlyChanged.
  1344 	^ self.
  1345     ].
  1346 !
  1347 
  1348 updateCopyPreviousTranslationButtonEnabled
  1349 
  1350      self pastePreviousTranslationEnableHolder value: self shouldCopyPreviousTranslationButtonBeEnabled
  1351 !
  1352 
  1353 updateExampleLanguageText
  1354 
  1355     self selectedKeyRow value isNil ifTrue:[^ self].
  1356     self exampleLanguageTextHolder value:self currentExampleLanguageText
  1357 !
  1358 
  1359 updateKeyStringsToLanguageMappings
  1360 
  1361       keyStringsToLanguageMappings
  1362 	at:lastSelectedKey
  1363 	language:lastLanguage
  1364 	put: self newLanguageText.
  1365 !
  1366 
  1367 updateLanguageAndKeySelection
  1368 
  1369     self originalTextHolder value: self selectedKey.
  1370     self languageTextHolder value: (self languageTextFromSelectedKeyFor: self currentLanguage).
  1371     lastLanguage := self currentLanguage.
  1372     lastSelectedKey := self selectedKey.
  1373 !
  1374 
  1375 updateLanguageTextModification
  1376      self languageTextModifiedHolder value ifTrue:[
  1377 	(self autoAccept or:[Dialog confirm:'Accept changed translation ?']) ifTrue:[
  1378 	    self languageTextModifiedHolder value:false.
  1379 	    self languageTextHolder value:languageEditor contents.
  1380 	    lastLanguage notNil ifTrue:[self updateKeyStringsToLanguageMappings.]
  1381 	]
  1382     ].
  1383 !
  1384 
  1385 updateOriginalTextModification
  1386 
  1387     |answer|
  1388 
  1389 	self originalTextModifiedHolder value ifTrue:[
  1390 	    answer := OptionBox
  1391 			  request:'Accept changed original text (key) ?'
  1392 			  label:'Original text (key) changed'
  1393 			  image:(WarningBox iconBitmap)
  1394 			  buttonLabels:#('Cancel' 'Accept' 'Accept As New')
  1395 			  values:#(nil #accept #acceptAsNew)
  1396 			  default:#acceptAsNew.
  1397 
  1398 	    answer isNil ifTrue:[^ self originalTextModifiedHolder value:false. ].
  1399 	    answer == #accept ifTrue:[
  1400     self halt.        ].
  1401 	    answer == #acceptAsNew ifTrue:[
  1402     self halt.        ].
  1403 	].
  1404 !
  1405 
  1406 updatePasteOriginalButtonEnabled
  1407 
  1408      self pasteOriginalEnableHolder value: self shouldPasteOriginalButtonBeEnabled
  1409 ! !
  1410 
  1411 !InternationalLanguageTranslationEditor methodsFor:'dialogs'!
  1412 
  1413 requestEncoderDialog
  1414 
  1415    |box val characterCollection|
  1416 
  1417     val := '' asValue.
  1418     box := Dialog new.
  1419     (box addTextLabel:'Select or write the encoder') adjust:#left.
  1420     box addVerticalSpace.
  1421     characterCollection := CharacterEncoder supportedExternalEncodings
  1422 	inject: OrderedCollection new
  1423 	into:[:collection :each |
  1424 	    collection add: each first;
  1425 			yourself].
  1426     (box addComboBoxOn:val) list: characterCollection.
  1427     box addOkButton.
  1428     box open.
  1429     ^val value
  1430 !
  1431 
  1432 requestEncoderStringFor: lang
  1433   "Returns an encoder string and updates the language's info"
  1434     |encoderString encoder|
  1435     encoderString := self requestEncoderDialog.
  1436     encoderString notEmpty ifTrue:[
  1437 	encoder := CharacterEncoder encoderFor: encoderString ifAbsent:nil.
  1438 	encoder notNil ifTrue:[keyStringsToLanguageMappings atLanguage: lang putEncoder: encoder.].
  1439     ].
  1440     ^encoderString
  1441 !
  1442 
  1443 requestFilename
  1444 
  1445     |aFilename|
  1446 
  1447     aFilename := Dialog
  1448 	requestFileName:(resources string:'Name of resource file:')
  1449 	default:nil
  1450 	pattern:'*.rs'.
  1451 
  1452     aFilename isEmptyOrNil ifTrue:[^ nil ].
  1453     ^aFilename asFilename
  1454 !
  1455 
  1456 requestFilenameFor: lang
  1457   "Returns a filename to save the language resource and updates the language's info"
  1458     |aFilename|
  1459 
  1460     aFilename := Dialog
  1461 	requestFileName:(resources string:'Name of resource file to save %1:' with:lang asString)
  1462 	default:nil
  1463 	pattern:'*.rs'.
  1464 
  1465     aFilename isEmptyOrNil ifTrue:[^ nil ].
  1466     keyStringsToLanguageMappings atLanguage: lang putFilename: aFilename.
  1467     ^aFilename asFilename
  1468 !
  1469 
  1470 requestLanguage
  1471     ^ Dialog
  1472 	choose:(resources string:'For which language ?')
  1473 	fromList:languagesList
  1474 	lines:10.
  1475 !
  1476 
  1477 requestLanguageToSave
  1478     ^ Dialog
  1479 	choose:'Which language do you want to save?'
  1480 	fromList:languagesList
  1481 	lines:10
  1482 !
  1483 
  1484 requestPackage
  1485     |package allProjects projectsWithResources|
  1486 
  1487     allProjects := Smalltalk allProjectIDs.
  1488     projectsWithResources := allProjects
  1489                                 select:[:pID |
  1490                                     |dir|
  1491                                     dir := Smalltalk projectDirectoryForPackage:pID.
  1492                                     dir notNil and:[
  1493                                     (dir asFilename construct:'resources') exists]
  1494                                 ].
  1495 
  1496     package := Dialog
  1497         requestProject:(resources string:'Name of Package:')
  1498         from:projectsWithResources
  1499         initialAnswer:LastProject
  1500         suggestions:nil.
  1501 
  1502     package isEmptyOrNil ifTrue:[^ nil ].
  1503     LastProject := package.
  1504     ^ package
  1505 ! !
  1506 
  1507 !InternationalLanguageTranslationEditor methodsFor:'images'!
  1508 
  1509 restartSearchBarIcon
  1510 
  1511     ^ self class restartSearchBarIcon
  1512 !
  1513 
  1514 warningSearchBarIcon
  1515 
  1516     ^ self class warningSearchBarIcon
  1517 ! !
  1518 
  1519 !InternationalLanguageTranslationEditor methodsFor:'initialization & release'!
  1520 
  1521 closeRequest
  1522     "asks for permission before closing"
  1523 
  1524     self hasUnsavedChanges ifTrue:[
  1525 	(Dialog
  1526 	    confirm:(resources string:'Close without saving ?')
  1527 	    default:false) ifFalse:[
  1528 	    ^ self
  1529 	]
  1530     ].
  1531 
  1532     super closeRequest
  1533 !
  1534 
  1535 initialize
  1536     modified := false.
  1537     inSingleFileMode := false.
  1538     super initialize
  1539 !
  1540 
  1541 languageEditorBuilt:aView
  1542     languageEditor := aView.
  1543 !
  1544 
  1545 postBuildDataSet:aView
  1546     dataSetView := aView.
  1547     aView selectedColIndexHolder onChangeSend:#selectionChanged to:self.
  1548 ! !
  1549 
  1550 !InternationalLanguageTranslationEditor methodsFor:'initialize'!
  1551 
  1552 postBuildSearchBoxView: aBoxView
  1553 
  1554     searchBoxView := aBoxView
  1555 
  1556     "Created: / 15-06-2007 / 18:02:38 / Administrador"
  1557 !
  1558 
  1559 postBuildSearchTextView: anEditFieldView
  1560 
  1561     searchTextView := anEditFieldView
  1562 
  1563     "Created: / 15-06-2007 / 18:17:15 / Administrador"
  1564 !
  1565 
  1566 postBuildTranslationsPanel: aPanel
  1567 
  1568     translationsPanel := aPanel
  1569 !
  1570 
  1571 postBuildWith:aBuilder
  1572 
  1573     super postBuildWith:aBuilder.
  1574     self updateToolVisibility.
  1575 ! !
  1576 
  1577 !InternationalLanguageTranslationEditor methodsFor:'menu actions'!
  1578 
  1579 addLanguage
  1580     |lang|
  1581 
  1582     lang := Dialog request:(resources string:'New language (ISO symbol):').
  1583     lang isEmptyOrNil ifTrue:[^ self].
  1584     self addLanguage:lang
  1585 !
  1586 
  1587 addLanguage:langArg
  1588     |lang|
  1589 
  1590     lang := langArg asSymbol.
  1591     (keyStringsToLanguageMappings includesLanguage:lang) ifTrue:[^ self ].
  1592 
  1593     keyStringsToLanguageMappings addLanguage:lang.
  1594     self languagesList add:lang.
  1595     self shownLanguages add:lang.
  1596     modified := true.
  1597 !
  1598 
  1599 addTranslation
  1600     |key index|
  1601 
  1602     key := Dialog request:'New Key:'.
  1603     key isEmpty ifTrue:[^self].
  1604     (self includesKey:key) ifFalse:[
  1605 	keyStringsToLanguageMappings addKey:key.
  1606 	modified := true.
  1607     ].
  1608    index := keyStringsToLanguageMappings indexOfKey:key.
  1609    self selectedKeyRow value:index
  1610 !
  1611 
  1612 changeLastNameSpace
  1613 
  1614     |nameSpace defaultNameSpace|
  1615 
  1616     lastNameSpace notNil ifTrue:[defaultNameSpace := lastNameSpace name].
  1617     nameSpace := Dialog requestNameSpace:'NameSpace:' title:'Search String in Name Space:' initialAnswer:defaultNameSpace.
  1618     nameSpace isNil ifTrue:[^self].
  1619     nameSpace := Smalltalk at:nameSpace asSymbol.
  1620     nameSpace isNil ifTrue:[
  1621 	^Dialog information:(resources string:'No such nameSpace exists.')
  1622     ].
  1623     lastNameSpace := nameSpace.
  1624 !
  1625 
  1626 changeLastPackage
  1627 
  1628     |package defaultPackage|
  1629 
  1630     lastPackage notNil ifTrue:[defaultPackage := lastPackage].
  1631     package := Dialog
  1632 	    requestProject:'Package:'
  1633 	    initialAnswer:defaultPackage
  1634 	    suggestions:#('foo' 'bar' 'baz').
  1635     package isNil ifTrue:[
  1636 	^ self "/ Dialog information:(resources string:'No such package exists.')
  1637     ].
  1638     lastPackage := package.
  1639 !
  1640 
  1641 extractTranslationsFromClass
  1642     |aClass newTranslations|
  1643 
  1644     aClass := Dialog
  1645 		requestClass:'Class to extract translations from:'
  1646 		okLabel:'OK'
  1647 		initialAnswer:(lastExtractedClass ? LastExtractedClass).
  1648     aClass isNil ifTrue:[^ self ].
  1649 
  1650     lastExtractedClass := LastExtractedClass := aClass.
  1651 
  1652     newTranslations := self extractTranslationsFromClass:aClass.
  1653     self addAllTranslations:newTranslations.
  1654 !
  1655 
  1656 extractTranslationsFromNameSpace
  1657 
  1658     |newTranslations|
  1659 
  1660     self changeLastNameSpace.
  1661     lastNameSpace isNil ifTrue:[^self.].
  1662     newTranslations := OrderedCollection new.
  1663     lastNameSpace allClassesDo:[:eachClass |
  1664 	newTranslations addAll:( self extractTranslationsFromClass:eachClass theNonMetaclass).
  1665     ].
  1666     self addAllTranslations:newTranslations.
  1667 !
  1668 
  1669 extractTranslationsFromProject
  1670     |box projectID newTranslations|
  1671 
  1672     box := ListSelectionBox new.
  1673 "/    box useComboBoxWithList:(Smalltalk allProjectIDs).
  1674     box title:(resources string:'Project to extract translations from:').
  1675     box list:Smalltalk allProjectIDs.
  1676     box okAction:[:sel | projectID := sel].
  1677     box initialText:(lastExtractedProject ? LastExtractedProject).
  1678     box label:'Find Translations in Project'.
  1679 
  1680     box showAtPointer.
  1681 
  1682     projectID notNil ifTrue:[
  1683 	projectID := projectID withoutSeparators asSymbol.
  1684     ].
  1685     projectID isEmptyOrNil ifTrue:[^ self ].
  1686 
  1687     lastExtractedProject := LastExtractedProject := projectID.
  1688 
  1689     newTranslations := Set new.
  1690 
  1691     Smalltalk allClassesDo:[:eachClass |
  1692 	eachClass theNonMetaclass package == projectID ifTrue:[
  1693 "/ eachClass isLoaded ifTrue:[ self halt. ].
  1694 	    newTranslations addAll:( self extractTranslationsFromClass:eachClass theNonMetaclass).
  1695 	]
  1696     ].
  1697 
  1698     self addAllTranslations:newTranslations.
  1699 !
  1700 
  1701 importExistingTranslationsFromFile
  1702     self information:'The import function is not available in this release'.
  1703 !
  1704 
  1705 inspectCanvasMissingStrings
  1706 
  1707     |spec nameSpace missingStrings|
  1708 
  1709     missingStrings := OrderedCollection new.
  1710     nameSpace := Dialog requestNameSpace:'NameSpace:' title:'Specify NameSpace to look for missing strings' initialAnswer:nil.
  1711     nameSpace := Smalltalk at:nameSpace asSymbol.
  1712     nameSpace isNil ifTrue:[
  1713 	^Dialog information:(resources string:'No such nameSpace exists.?')
  1714     ].
  1715 
  1716     nameSpace allClassesDo:[:cls |
  1717 	cls theMetaclass methodsDo:[:m |
  1718 	    m hasResource ifTrue:[
  1719 		(m resources includesKey:#canvas) ifTrue:[
  1720 		    spec := (cls perform:m selector) decodeAsLiteralArray.
  1721 		    spec do:[:eachComponent |
  1722 			eachComponent translationKeysDo:[:k |
  1723 			    (self includesKey: k) ifFalse:[
  1724 				missingStrings add: k.
  1725 				Transcript showCR: k storeString, '                         ', m printString]]
  1726 		    ]
  1727 		]
  1728 	    ]
  1729 	]
  1730     ].
  1731     missingStrings asSet inspect
  1732 !
  1733 
  1734 menuNew
  1735     modified ifTrue:[
  1736 	(Dialog
  1737 	    confirm:(resources stringWithCRs:'Modified translations have not been changed.\\Create new translations set anyway ?')
  1738 	    default:false) ifFalse:[^ self].
  1739     ].
  1740 
  1741     keyStringsToLanguageMappings initialize.
  1742     keyStringsToLanguageMappings changed.
  1743 
  1744     self languagesList contents:self keyStringAndLanguageSelectionTable languages.
  1745     self shownLanguages contents:self keyStringAndLanguageSelectionTable languages.
  1746     modified := false.
  1747 !
  1748 
  1749 menuOpen
  1750     |aFilename|
  1751 
  1752     self withWaitCursorDo:[
  1753 	aFilename := self requestFilename.
  1754 	aFilename isNil ifTrue:[^ self ].
  1755 	self readResourceFile:aFilename.
  1756     ]
  1757 !
  1758 
  1759 menuOpenByPackage
  1760     |package|
  1761 
  1762     self withWaitCursorDo:[
  1763 	package := self requestPackage.
  1764 	package isNil ifTrue:[^ self ].
  1765 	self readResourceFileForPackage:package.
  1766     ]
  1767 !
  1768 
  1769 menuSave
  1770 "Saves the language selected in the fileName from where the language resource was obtained."
  1771     |lang|
  1772 
  1773     lang := self requestLanguageToSave.
  1774     lang isNil ifTrue:[^ self].
  1775     self saveLanguage: lang
  1776 !
  1777 
  1778 menuSaveAll
  1779 "Saves all the languages in the fileName from where the language resource was obtained."
  1780     keyStringsToLanguageMappings languagesInUse do:[:each | self saveLanguage: each].
  1781 !
  1782 
  1783 menuSaveAs
  1784 "Saves the language selected in the specified fileName."
  1785      |lang aFilename|
  1786 
  1787     lang := self requestLanguageToSave.
  1788     lang isNil ifTrue:[^ self].
  1789     aFilename := self requestFilenameFor:lang.
  1790     aFilename isNil ifTrue:[^ self].
  1791     self saveResourceFile:aFilename for:lang asSymbol
  1792 !
  1793 
  1794 openAboutThisApplication
  1795     "This method was generated by the Browser.
  1796      It will be invoked when the menu-item 'help-about' is selected."
  1797 
  1798     "/ could open a customized aboutBox here ...
  1799     super openAboutThisApplication
  1800 !
  1801 
  1802 openDocumentation
  1803     "This method was generated by the Browser.
  1804      It will be invoked when the menu-item 'help-documentation' is selected."
  1805 
  1806     "/ change below as required ...
  1807 
  1808     "/ to open an HTML viewer on some document (under 'doc/online/<language>/' ):
  1809     HTMLDocumentView openFullOnDocumentationFile:'tools/languageEditor/TOP.html'.
  1810 
  1811     "/ add application-specific help files under the 'doc/online/<language>/help/appName'
  1812     "/ directory, and open a viewer with:
  1813     "/ HTMLDocumentView openFullOnDocumentationFile:'help/<MyApplication>/TOP.html'.
  1814 !
  1815 
  1816 readResourceFile:aFilename
  1817     |lang|
  1818 
  1819     lang := self requestLanguage.
  1820     lang isNil ifTrue:[^ self ].
  1821 
  1822     self readResourceFile:aFilename asLanguage:lang asSymbol
  1823 !
  1824 
  1825 readResourceFileForPackage:aPackage
  1826     |allLanguages lang packageDir resourceDir langFile|
  1827 
  1828     packageDir := Smalltalk packageDirectoryForPackageId:aPackage.
  1829     resourceDir := packageDir asFilename construct:'resources'.
  1830 
  1831     allLanguages := Set new.
  1832     resourceDir directoryContentsAsFilenamesDo:[:eachFile |
  1833 	eachFile suffix = 'rs' ifTrue:[
  1834 	    (('##.rs' match:eachFile baseName)
  1835 	    or:[('##-##.rs' match:eachFile baseName)]) ifTrue:[
  1836 		allLanguages add:(eachFile withoutSuffix baseName)
  1837 	    ].
  1838 	].
  1839     ].
  1840 
  1841     allLanguages addAll:languagesList.
  1842     allLanguages := allLanguages asSortedCollection.
  1843 
  1844     lang := Dialog
  1845 	choose:(resources string:'For which language ?')
  1846 	fromList:allLanguages
  1847 	values:allLanguages
  1848 	buttons:(resources array:#('All'))
  1849 	values:#(all)
  1850 	lines:10
  1851 	cancel:nil.
  1852 
  1853     lang isNil ifTrue:[^ self ].
  1854 
  1855     langFile := resourceDir construct:lang,'.rs'.
  1856 
  1857     lang == #all ifTrue:[
  1858 	allLanguages do:[:lang |
  1859 	    self addLanguage:lang.
  1860 	    self readResourceFile:(resourceDir construct:lang,'.rs') asLanguage:lang.
  1861 	].
  1862     ] ifFalse:[
  1863 	self readResourceFile:langFile asLanguage:lang asSymbol
  1864     ].
  1865 !
  1866 
  1867 removeLanguage
  1868     |lang|
  1869 
  1870     lang := Dialog choose:'Which language do you want to remove?' fromList:languagesList lines:10.
  1871     lang isNil ifTrue:[^ self ].
  1872     (Dialog confirm: 'Are you sure to remove the language ', lang ) ifTrue:[
  1873 	  self languagesList remove:lang.
  1874 	  self shownLanguages remove:lang.
  1875     ].
  1876 !
  1877 
  1878 removeTranslation
  1879     |rowSelectionIndex selectedKey|
  1880 
  1881     rowSelectionIndex := self selectedKeyRow value.
  1882     rowSelectionIndex isNil ifTrue:[^self].
  1883     rowSelectionIndex ~~ 0 ifTrue:[
  1884 	selectedKey := keyStringsToLanguageMappings keyAt:rowSelectionIndex ifAbsent:nil.
  1885 	selectedKey isNil ifTrue:[^self].
  1886 	(Dialog confirm:(resources string:'Really remove key %1' with:selectedKey)) ifTrue:[
  1887 	    keyStringsToLanguageMappings removeKey:selectedKey.
  1888 	].
  1889     ].
  1890 !
  1891 
  1892 runApplicationAndCollectTranslations
  1893     |applicationClass newTranslations pseudoPack app startSelector|
  1894 
  1895     monitoredApplication notNil ifTrue:[
  1896 	monitoredApplication terminate.
  1897 	[monitoredApplication notNil] whileTrue:[
  1898 	    Delay waitForSeconds:0.1
  1899 	].
  1900     ].
  1901 
  1902     applicationClass := Dialog
  1903 		requestClass:'Application class to start and collect translations from:'
  1904 		okLabel:'OK'
  1905 		initialAnswer:(lastExtractedApplicationClass ? LastExtractedApplicationClass ).
  1906     applicationClass isNil ifTrue:[^ self ].
  1907     applicationClass isNamespace ifTrue:[
  1908 	Dialog warn:'Entered class is a NameSpace'.
  1909 	^ self.
  1910     ].
  1911 
  1912     applicationClass isVisualStartable ifTrue:[
  1913 	startSelector := #open
  1914     ] ifFalse:[
  1915 	startSelector := Dialog
  1916 		    request:'Entered class seems to be no application class. Ok to start using selector:'
  1917 		    initialAnswer:((applicationClass respondsTo:#'start')
  1918 					ifTrue:#'start'
  1919 					ifFalse:#'new')
  1920 		    okLabel:'START'
  1921 		    title:'Start Application'.
  1922 	startSelector isNil ifTrue:[
  1923 	    ^ self
  1924 	].
  1925 	startSelector := startSelector asSymbol.
  1926     ].
  1927 
  1928     lastExtractedApplicationClass := LastExtractedApplicationClass := applicationClass.
  1929 
  1930     newTranslations := Set new.
  1931 
  1932     pseudoPack := AccessCollectingPseudoResourcePack new.
  1933     pseudoPack realResourcePack:(applicationClass classResources).
  1934 
  1935     self stopApplicationIconVisibleHolder value:true.
  1936 
  1937     monitoredApplication := [
  1938 	[
  1939 	    app := applicationClass new.
  1940 	    app perform:startSelector.
  1941 	    app window waitUntilVisible.
  1942 	    app window waitUntilClosed.
  1943 	] ensure:[
  1944 	    app closeRequest.
  1945 	    self stopApplicationIconVisibleHolder value:false.
  1946 	    monitoredApplication := nil.
  1947 	].
  1948     ] fork.
  1949 !
  1950 
  1951 searchStringInLastNameSpace
  1952 
  1953     |selectedKey browser lastSearchPatterns|
  1954 
  1955     selectedKey := self selectedKey.
  1956     selectedKey isNil ifTrue:[^Dialog information: 'No selected key'].
  1957     browser := NewSystemBrowser new "open".
  1958     browser allButOpen.
  1959     lastSearchPatterns := browser lastSearchPatterns.
  1960     (lastSearchPatterns notNil and:[lastSearchPatterns first ~= selectedKey]) ifTrue:[
  1961 	browser lastSearchPatterns addFirst: selectedKey
  1962     ].
  1963     SearchDialog lastStringSearchArea: #currentNameSpace.
  1964     lastNameSpace isNil ifTrue:[
  1965 	self changeLastNameSpace.
  1966     ].
  1967     lastNameSpace notNil ifTrue:[
  1968 "/        browser navigationState selectedClasses value: lastNameSpace allClasses.
  1969 	browser navigationState nameSpaceFilter value: (OrderedCollection with:lastNameSpace name).
  1970 	browser navigationState selectedNamespaces value: (OrderedCollection with:lastNameSpace name).
  1971     ].
  1972     self withWaitCursorDo:[
  1973 	browser browseMenuMethodsWithString
  1974     ].
  1975 !
  1976 
  1977 searchStringInLastPackage
  1978 
  1979     | selectedKey browser lastSearchPatterns|
  1980 
  1981     selectedKey := self selectedKey.
  1982     selectedKey isNil ifTrue:[^Dialog information: 'No selected key'].
  1983     browser := NewSystemBrowser new "open".
  1984     browser allButOpen.
  1985     lastSearchPatterns := browser lastSearchPatterns.
  1986     (lastSearchPatterns notNil and:[lastSearchPatterns first ~= selectedKey]) ifTrue:[
  1987 	browser lastSearchPatterns addFirst: selectedKey
  1988     ].
  1989     SearchDialog lastStringSearchArea: #currentPackage.
  1990     lastPackage isNil ifTrue:[
  1991 	self changeLastPackage.
  1992     ].
  1993     lastPackage notNil ifTrue:[
  1994 "/        browser navigationState selectedClasses value: lastNameSpace allClasses.
  1995 	browser navigationState packageFilter value: (OrderedCollection with:lastPackage).
  1996 	browser navigationState selectedProjects value: (OrderedCollection with:lastPackage).
  1997     ].
  1998     self withWaitCursorDo:[
  1999 	browser browseMenuMethodsWithString
  2000     ].
  2001 ! !
  2002 
  2003 !InternationalLanguageTranslationEditor methodsFor:'menus dynamic'!
  2004 
  2005 disableLanguageDisplayFor:lang
  2006     self shownLanguages remove:lang ifAbsent:[]
  2007 !
  2008 
  2009 enableLanguageDisplayFor:newLang
  2010     |shownLanguagesInOrder|
  2011 
  2012     (self shownLanguages includes:newLang) ifFalse:[
  2013 "/        shownLanguagesInOrder := self languagesList
  2014 "/                                    select:[:lang | (self shownLanguages includes:lang)
  2015 "/                                                    or:[ lang = newLang ]].
  2016 "/        self shownLanguages contents:shownLanguagesInOrder.
  2017 	self shownLanguages add:newLang.
  2018     ]
  2019 !
  2020 
  2021 isLanguageShown:lang
  2022     ^ self shownLanguages includes:lang
  2023 !
  2024 
  2025 shownLanguagesMenu
  2026     <resource: #programMenu >
  2027 
  2028     ^ [
  2029 	|m selected|
  2030 
  2031 	m := Menu new.
  2032 
  2033 	self languagesList do:[:lang |
  2034 	    |item|
  2035 
  2036 	    item := MenuItem label:lang.
  2037 	    item indication:(self languageShownHolderFor:lang).
  2038 	    item hideMenuOnActivated:false.
  2039 	    m addItem:item.
  2040 	].
  2041 	m
  2042     ].
  2043 !
  2044 
  2045 toggleLanguageDisplayFor:lang
  2046     (self shownLanguages includes:lang) ifTrue:[
  2047 	self disableLanguageDisplayFor:lang
  2048     ] ifFalse:[
  2049 	self enableLanguageDisplayFor:lang
  2050     ].
  2051 ! !
  2052 
  2053 !InternationalLanguageTranslationEditor methodsFor:'private-key extraction'!
  2054 
  2055 addAllTranslations:newTranslations
  2056     |newTranslationKeys stringKeys nonStringKeys|
  2057 
  2058     newTranslationKeys := newTranslations select:[:k | k notEmpty and:[k isString not or:[k isBlank not]]].
  2059     newTranslationKeys := newTranslationKeys select:[:k | (keyStringsToLanguageMappings includesKey:k) not].
  2060     newTranslationKeys := newTranslationKeys
  2061 				collect:[:k |
  2062 					(k endsWith:'...') ifTrue:[
  2063 					    k copyWithoutLast:3.
  2064 					] ifFalse:[
  2065 					    ('.:?' includes:k last) ifTrue:[
  2066 						k copyWithoutLast:1.
  2067 					    ] ifFalse:[
  2068 						k
  2069 					]]].
  2070     newTranslationKeys := newTranslationKeys asSet.
  2071 
  2072     newTranslationKeys notEmpty ifTrue:[
  2073 	stringKeys := newTranslationKeys select:[:k | k isString].
  2074 	nonStringKeys := newTranslationKeys select:[:k | k isString not].
  2075 
  2076 	stringKeys := stringKeys asSortedCollection.
  2077 	keyStringsToLanguageMappings addKeys:stringKeys.
  2078 	keyStringsToLanguageMappings addKeys:nonStringKeys.
  2079 	modified := true.
  2080     ].
  2081 !
  2082 
  2083 extractTranslationsFromClass:aClass
  2084     |newTranslations|
  2085 
  2086     newTranslations := Set new.
  2087 
  2088     self withWaitCursorDo:[
  2089 	"/ now, the hard part:
  2090 	"/ possible translations are in the specs,
  2091 	"/ and all arguments to (resources string:) messages.
  2092 	aClass instAndClassMethodsDo:[:eachMethod |
  2093 	    newTranslations addAll:( self extractTranslationsFromMethod:eachMethod ).
  2094 	].
  2095     ].
  2096     ^ newTranslations
  2097 !
  2098 
  2099 extractTranslationsFromHelpSpecMethod:aMethod
  2100     |codeStrings matcher parseTree resourceKeys|
  2101 
  2102     parseTree := RBParser
  2103 	    parseMethod:aMethod source
  2104 	    onError: [:str :pos | Transcript showCR:str. Transcript showCR:pos.
  2105 				  nil].
  2106     parseTree isNil ifTrue:[^ #() ].
  2107 
  2108     codeStrings  :=
  2109 	#(
  2110 		'`@dict addPairsFrom: `#helpKeysAndStrings'
  2111 	).
  2112 
  2113     resourceKeys := Set new.
  2114 
  2115     matcher := ParseTreeSearcher new.
  2116     matcher
  2117 	matchesAnyOf: codeStrings
  2118 	do: [:aNode :answer |
  2119 		|sel argNode arg|
  2120 
  2121 		sel := aNode selector.
  2122 		(sel startsWith:'addPairsFrom:') ifTrue:[
  2123 		    argNode := aNode arguments at:1.
  2124 		    argNode isLiteral ifTrue:[
  2125 			arg := argNode value.
  2126 			arg isArray ifTrue:[
  2127 			    arg doWithIndex:[:el :index |
  2128 				index even ifTrue:[
  2129 				    el isString ifTrue:[
  2130 					resourceKeys add:el.
  2131 				    ]
  2132 				].
  2133 			    ].
  2134 			] ifFalse:[
  2135 			    Transcript
  2136 				showCR:(resources
  2137 					string:'Cannot derive resourceKey from non-array in %1 in %2'
  2138 					with:argNode formattedCode
  2139 					with:aMethod selector).
  2140 			].
  2141 		    ] ifFalse:[
  2142 			Transcript
  2143 			    showCR:(resources
  2144 					string:'Cannot derive resourceKey from non-literal: %1 in %2'
  2145 					with:argNode formattedCode
  2146 					with:aMethod selector).
  2147 		    ].
  2148 		].
  2149 		aNode
  2150 	    ].
  2151 
  2152     matcher executeTree: parseTree initialAnswer: nil.
  2153     ^ resourceKeys
  2154 !
  2155 
  2156 extractTranslationsFromMenuSpecMethod:aMethod
  2157     |menu resourceKeys|
  2158 
  2159     menu := aMethod mclass theNonMetaclass perform:aMethod selector.
  2160     menu isNil ifTrue:[ ^ #() ].
  2161 
  2162     (menu isKindOf:Menu) ifFalse:[
  2163 	menu := Menu new fromLiteralArrayEncoding:menu
  2164     ].
  2165 
  2166     resourceKeys := Set new.
  2167     menu allItemsDo:[:aMenuItem |
  2168 	aMenuItem translateLabel ifTrue:[
  2169 	    aMenuItem isSeparatorItem ifFalse:[
  2170 		resourceKeys add:aMenuItem label.
  2171 	    ]
  2172 	]
  2173     ].
  2174     ^ resourceKeys
  2175 !
  2176 
  2177 extractTranslationsFromMethod:aMethod
  2178     |mResources|
  2179 
  2180     mResources := aMethod resources.
  2181     mResources notNil ifTrue:[
  2182 	(mResources includesKey:#menu) ifTrue:[
  2183 	     ^ self extractTranslationsFromMenuSpecMethod:aMethod.
  2184 	].
  2185 	(mResources includesKey:#canvas) ifTrue:[
  2186 	     ^ self extractTranslationsFromUISpecMethod:aMethod.
  2187 	].
  2188 	(mResources includesKey:#help) ifTrue:[
  2189 	     ^ self extractTranslationsFromHelpSpecMethod:aMethod.
  2190 	].
  2191 	(mResources includesKey:#tableColumns) ifTrue:[
  2192 	     ^ self extractTranslationsFromTableColumnsSpecMethod:aMethod.
  2193 	].
  2194 
  2195 	^ self extractTranslationsFromSpecMethod:aMethod.
  2196     ].
  2197     ^ self extractTranslationsFromMethodsCode:aMethod
  2198 !
  2199 
  2200 extractTranslationsFromMethodsCode:aMethod
  2201 "/method:mthd selector:sel inClass:cls matchesParseTreeMatcher:aMatcher
  2202     |codeStrings matcher parseTree resourceKeys|
  2203 
  2204     parseTree := RBParser
  2205 	    parseMethod:aMethod source
  2206 	    onError: [:str :pos | Transcript showCR:str. Transcript showCR:pos.
  2207 				  nil].
  2208     parseTree isNil ifTrue:[^ #() ].
  2209 
  2210     codeStrings  :=
  2211 	#(
  2212 		'resources `@msg: `@args'
  2213 		'self resources `@msg: `@args'
  2214 		'self class resources `@msg: `@args'
  2215 		'self classResources `@msg: `@args'
  2216 	).
  2217 
  2218     resourceKeys := Set new.
  2219 
  2220     matcher := ParseTreeSearcher new.
  2221     matcher
  2222 	matchesAnyOf: codeStrings
  2223 	do: [:aNode :answer |
  2224 		|sel keyStringArgNode keyStringArg|
  2225 
  2226 		sel := aNode selector.
  2227 		((sel startsWith:'string:') or:[(sel startsWith:'at:')]) ifTrue:[
  2228 		    keyStringArgNode := aNode arguments at:1.
  2229 		    keyStringArgNode isLiteral ifTrue:[
  2230 			keyStringArg := keyStringArgNode value.
  2231 			keyStringArg isString ifTrue:[
  2232 			    resourceKeys add:keyStringArg.
  2233 			] ifFalse:[
  2234 			    Transcript
  2235 				showCR:(resources
  2236 					string:'Cannot derive resourceKey from non-string: %1 in %2'
  2237 					with:keyStringArgNode formattedCode
  2238 					with:aMethod selector).
  2239 			].
  2240 		    ] ifFalse:[
  2241 			Transcript
  2242 			    showCR:(resources
  2243 					string:'Cannot derive resourceKey from non-literal: %1 in %2'
  2244 					with:keyStringArgNode formattedCode
  2245 					with:aMethod selector).
  2246 		    ].
  2247 		].
  2248 		aNode
  2249 	    ].
  2250 
  2251     matcher executeTree: parseTree initialAnswer: nil.
  2252     ^ resourceKeys
  2253 !
  2254 
  2255 extractTranslationsFromSpecMethod:aMethod
  2256     ^ #()
  2257 !
  2258 
  2259 extractTranslationsFromTableColumnsSpecMethod:aMethod
  2260     |columnDescription resourceKeys|
  2261 
  2262     columnDescription := aMethod mclass theNonMetaclass perform:aMethod selector.
  2263     columnDescription isNil ifTrue:[ ^ #() ].
  2264 
  2265     (columnDescription first isKindOf:DataSetColumnSpec) ifFalse:[
  2266 	columnDescription := columnDescription collect:[:el | DataSetColumnSpec new fromLiteralArrayEncoding:el].
  2267     ].
  2268 
  2269     resourceKeys := Set new.
  2270     columnDescription do:[:aColumnSpec |
  2271 	aColumnSpec translateLabel ifTrue:[
  2272 	    resourceKeys add:aColumnSpec label.
  2273 	]
  2274     ].
  2275     ^ resourceKeys
  2276 !
  2277 
  2278 extractTranslationsFromUISpecMethod:aMethod
  2279     |spec resourceKeys visitor|
  2280 
  2281     spec := aMethod mclass theNonMetaclass perform:aMethod selector.
  2282     spec isNil ifTrue:[ ^ #() ].
  2283 
  2284     (spec isKindOf:UISpecification) ifFalse:[
  2285 	spec := UISpecification from:spec
  2286     ].
  2287 
  2288     resourceKeys := Set new.
  2289 
  2290     visitor := UISpecVisitor new.
  2291     spec acceptVisitor:visitor.
  2292 
  2293     ^ visitor translatedLabels
  2294 ! !
  2295 
  2296 !InternationalLanguageTranslationEditor methodsFor:'queries'!
  2297 
  2298 autoAccept
  2299 
  2300     ^ self autoAcceptHolder value
  2301 !
  2302 
  2303 currentExampleLanguageText
  2304    "Returns the language text corresponding for the current selected key and the example language selection"
  2305 
  2306   ^self languageTextFromSelectedKeyFor: self exampleLanguageSelectionHolder value
  2307 !
  2308 
  2309 currentLanguage
  2310 
  2311     |colSelectionIndex |
  2312 
  2313     colSelectionIndex := dataSetView selectedColIndex.
  2314     ^colSelectionIndex > 1 ifTrue:[ shownLanguages at:colSelectionIndex-1 ] ifFalse:nil.
  2315 !
  2316 
  2317 exampleLanguageByDefault
  2318 
  2319     ^self shownLanguages isEmpty
  2320 	ifTrue:[nil]
  2321 	ifFalse:[self shownLanguages first]
  2322 !
  2323 
  2324 hasFirstRowSelection
  2325     self selectedKeyRow isNil ifTrue:[^false].
  2326     ^ self selectedKeyRow value > 1
  2327 !
  2328 
  2329 hasLanguageSelection
  2330     dataSetView selectedColIndex isNil ifTrue:[^false].
  2331     ^ dataSetView selectedColIndex > 1
  2332 !
  2333 
  2334 hasUnsavedChanges
  2335     ^ modified
  2336 !
  2337 
  2338 includesKey: aKey
  2339     keyStringsToLanguageMappings isNil ifTrue:[^false].
  2340     ^keyStringsToLanguageMappings includesKey:aKey
  2341 !
  2342 
  2343 isSearchForSimilarTranslationEnabled
  2344 
  2345     ^self searchForSimilarTranslationEnableHolder value
  2346 !
  2347 
  2348 languageTextFromKey: aKeyIndex for: language
  2349     "Returns the language text corresponding for the aKeyIndex and the received language"
  2350 
  2351     language isNil ifTrue:[^''].
  2352     ^keyStringsToLanguageMappings at: aKeyIndex language:language.
  2353 !
  2354 
  2355 languageTextFromSelectedKeyFor: language
  2356     "Returns the language text corresponding for the current selected key and the received language"
  2357 
  2358     ^self languageTextFromKey: self selectedKey for: language
  2359 !
  2360 
  2361 shouldCopyPreviousTranslationButtonBeEnabled
  2362     ^ self hasLanguageSelection
  2363 	and:[self hasFirstRowSelection]
  2364 !
  2365 
  2366 shouldPasteOriginalButtonBeEnabled
  2367     ^ self hasLanguageSelection
  2368 	and:[self hasFirstRowSelection]
  2369 !
  2370 
  2371 shouldSearchForSimilarTranslation
  2372 
  2373     self isSearchForSimilarTranslationEnabled ifFalse:[^false].
  2374     (self languageTextHolder value notNil and:[self languageTextHolder value notEmpty]) ifTrue:[^false].
  2375     (self hasLanguageSelection and:[self selectedKeyRow notNil]) ifFalse:[^false].
  2376     ^true
  2377 ! !
  2378 
  2379 !InternationalLanguageTranslationEditor methodsFor:'read/write resourceFile'!
  2380 
  2381 encoderAt: lang
  2382 
  2383     self alwaysWriteUTF8Holder value ifTrue:[^CharacterEncoder encoderForUTF8].
  2384     ^keyStringsToLanguageMappings encoderAt: lang.
  2385 !
  2386 
  2387 printEditingWarningOn: aStream
  2388 
  2389     aStream nextPutAll: ';';
  2390 	    cr;
  2391 	    nextPutAll: '; WARNING:';
  2392 	    cr;
  2393 	    nextPutAll: '; this file contains national characters';
  2394 	    cr;
  2395 	    nextPutAll: '; DONT EDIT this file with an old vi !!';
  2396 	    cr;
  2397 	    nextPutAll: ';';
  2398 	    cr;
  2399 	    cr.
  2400 !
  2401 
  2402 printEncoderFor: lang on: aStream
  2403     |characterEncoder encoderString|
  2404 
  2405     characterEncoder := self encoderAt: lang.
  2406     encoderString := characterEncoder isNil
  2407 	ifTrue:[self requestEncoderStringFor: lang]
  2408 	ifFalse:[characterEncoder nameOfEncoding printString].
  2409 
  2410     aStream nextPutAll: '#encoding';
  2411 	    space;
  2412 	    nextPutAll: encoderString;
  2413 	    cr;
  2414 	    cr.
  2415 !
  2416 
  2417 printLanguage: lang on: aStream
  2418 
  2419     self printEncoderFor: lang on: aStream.
  2420     self printEditingWarningOn: aStream.
  2421     self printLanguageMappingsFor: lang on: aStream.
  2422 !
  2423 
  2424 printLanguageMappingsFor: lang on: aStream
  2425 
  2426     |orderedAssociations maxKeySize characterEncoder|
  2427 
  2428     characterEncoder := self encoderAt: lang.
  2429     characterEncoder isNil ifTrue:[ characterEncoder := CharacterEncoder::NullEncoder ].
  2430     orderedAssociations := keyStringsToLanguageMappings orderedLanguageMappingsAssociationsFor: lang.
  2431 
  2432     maxKeySize := keyStringsToLanguageMappings maxKeySizeForLanguage: lang.
  2433 
  2434     orderedAssociations do:[:association |
  2435 	aStream nextPutAll: (association key storeString paddedTo: maxKeySize) ;
  2436 	    nextPutAll: (String new: 10);
  2437 	    nextPutAll: (characterEncoder encodeString: association value) storeString;
  2438 	    cr.
  2439 	].
  2440 !
  2441 
  2442 readResourceFile:aFilename asLanguage:lang
  2443     |resourcePack inStream lineString encoding decoder sortedKeys remainingKeys|
  2444 
  2445     aFilename exists ifFalse:[
  2446 	Dialog information:(resources string:'Language file: "%1" does not exist' with:aFilename baseName).
  2447 	^ self
  2448     ].
  2449 
  2450     resourcePack := ResourcePack new.
  2451 
  2452     inStream := aFilename readStream.
  2453     [inStream atEnd] whileFalse:[
  2454 	lineString := inStream nextLine.
  2455 	(lineString notEmpty
  2456 	and:[ (lineString startsWith:';') not ]) ifTrue:[
  2457 	    ((lineString startsWith:'#') and:[(lineString startsWith:'#(') not]) ifTrue:[
  2458 		lineString := (lineString copyFrom:2) withoutSeparators.
  2459 		(lineString startsWith:'encoding ') ifTrue:[
  2460 		    encoding := ResourcePack extractEncodingFromLine:lineString.
  2461 		    decoder := CharacterEncoder encoderFor:encoding ifAbsent:nil.
  2462 		].
  2463 	    ] ifFalse:[
  2464 		ResourcePack
  2465 		    processResourceLine:lineString
  2466 		    encoding:decoder
  2467 		    file:aFilename pathName
  2468 		    printErrorWith:[:msg | Transcript showCR:msg ]
  2469 		    for:resourcePack
  2470 		    keepUselessTranslations:true.
  2471 	    ].
  2472 	].
  2473     ].
  2474     inStream close.
  2475 
  2476     sortedKeys := (resourcePack keys select:[:k | k isString]) asSortedCollection.
  2477     remainingKeys := resourcePack keys select:[:k | k isString not].
  2478 
  2479     keyStringsToLanguageMappings atLanguage: lang putFilename: aFilename.
  2480     keyStringsToLanguageMappings atLanguage: lang putEncoder: decoder.
  2481 
  2482     sortedKeys do:[:k |
  2483 	keyStringsToLanguageMappings at:k language:lang put:(resourcePack at:k) sendChange:false
  2484     ].
  2485     remainingKeys do:[:k |
  2486 	keyStringsToLanguageMappings at:k language:lang put:(resourcePack at:k) sendChange:false
  2487     ].
  2488     keyStringsToLanguageMappings changed.
  2489 !
  2490 
  2491 saveLanguage: lang
  2492 "Saves the language in the fileName from where the language resource was obtained."
  2493     |aFilename|
  2494 
  2495     lang isNil ifTrue:[^ self].
  2496     aFilename := keyStringsToLanguageMappings filenameAt:lang.
  2497     aFilename isNil ifTrue:[
  2498 	aFilename := self requestFilenameFor: lang.
  2499 	aFilename isNil ifTrue:[^ self].
  2500     ].
  2501     self saveResourceFile:aFilename for:lang asSymbol
  2502 !
  2503 
  2504 saveResourceFile: aFilename for: lang
  2505 
  2506     |aStream |
  2507 
  2508     keyStringsToLanguageMappings atLanguage: lang putFilename: aFilename.
  2509     aStream := FileStream newFileNamed: aFilename.
  2510     self printLanguage: lang on: aStream.
  2511     aStream flush;
  2512 	    close.
  2513     DialogBox information: 'The resource file for the language ', lang printString storeString, ' was saved in the file: ', aFilename nameString
  2514 ! !
  2515 
  2516 !InternationalLanguageTranslationEditor methodsFor:'searching'!
  2517 
  2518 ignoreCaseHolderChanged
  2519 
  2520     self searchNextTextIncludingCurrentSelection: true.
  2521 
  2522     "Created: / 16-06-2007 / 09:33:33 / Administrador"
  2523 !
  2524 
  2525 searchNextText
  2526 
  2527     self searchNextTextIncludingCurrentSelection: false.
  2528 
  2529     "Modified: / 16-06-2007 / 09:21:14 / Administrador"
  2530 !
  2531 
  2532 searchNextTextFromBeginning
  2533     |searchText rowFoundIndex|
  2534 
  2535     searchText := searchTextView contents.
  2536     searchText isEmptyOrNil ifTrue:[^self].
  2537     self objectsList isEmpty ifTrue:[^self].
  2538     rowFoundIndex := self tableView findFirstRowWithString: searchText
  2539 		from:1
  2540 		to:self objectsList size
  2541 		ignoreCase:self ignoreCaseHolder value.
  2542     rowFoundIndex isNil ifTrue:[
  2543 	self searchTextNotFound.
  2544 	^self
  2545     ].
  2546     self selectListIndex: rowFoundIndex
  2547 
  2548     "Created: / 16-06-2007 / 10:54:51 / Administrador"
  2549     "Modified: / 19-06-2007 / 15:38:59 / Administrador"
  2550 !
  2551 
  2552 searchNextTextIncludingCurrentSelection: includeCurrentSelection
  2553     |searchText currentSelectionIndex rowFoundIndex fromIndex listSize|
  2554 
  2555     self searchTextStarted.
  2556     searchText := searchTextView contents.
  2557     searchText isEmptyOrNil ifTrue:[^self].
  2558     self objectsList isEmpty ifTrue:[^self].
  2559     currentSelectionIndex := self currentSelectionIndex.
  2560     (currentSelectionIndex isNil or:[currentSelectionIndex == 0]) ifTrue:[
  2561 	self searchNextTextFromBeginning.
  2562 	^self.
  2563     ].
  2564     listSize := self objectsList size.
  2565     (currentSelectionIndex == listSize and:[includeCurrentSelection not]) ifTrue:[
  2566 	self searchNextTextReachEnd.
  2567 	^self.
  2568     ].
  2569     fromIndex := includeCurrentSelection
  2570 	ifTrue:[currentSelectionIndex]
  2571 	ifFalse:[currentSelectionIndex + 1].
  2572     rowFoundIndex := self tableView findFirstRowWithString: searchText
  2573 		from:fromIndex
  2574 		to:listSize
  2575 		ignoreCase:self ignoreCaseHolder value.
  2576     rowFoundIndex isNil ifTrue:[
  2577 	self searchNextTextReachEnd.
  2578 	^self
  2579     ].
  2580     self selectListIndex: rowFoundIndex
  2581 
  2582     "Created: / 16-06-2007 / 09:20:57 / Administrador"
  2583     "Modified: / 19-06-2007 / 15:38:06 / Administrador"
  2584 !
  2585 
  2586 searchNextTextReachEnd
  2587     |message|
  2588     message := 'End of list reached, starting from the beginning'.
  2589     self searchTextRestarted: message.
  2590     Smalltalk beep.
  2591     self searchNextTextFromBeginning.
  2592 
  2593     "Created: / 16-06-2007 / 11:00:59 / Administrador"
  2594 !
  2595 
  2596 searchPreviousText
  2597 
  2598     |searchText currentSelectionIndex rowFoundIndex fromIndex|
  2599 
  2600     self searchTextStarted.
  2601     searchText := searchTextView contents.
  2602     searchText isEmptyOrNil ifTrue:[^self].
  2603     self objectsList isEmpty ifTrue:[^self].
  2604     currentSelectionIndex := self currentSelectionIndex.
  2605     currentSelectionIndex == 1 ifTrue:[
  2606 	self searchPreviousTextReachBeginning.
  2607 	^self.
  2608     ].
  2609     (currentSelectionIndex isNil or:[currentSelectionIndex == 0])
  2610 	ifTrue:[
  2611 	    self searchPreviousTextFromEnd.
  2612 	    ^self.
  2613 	]
  2614 	ifFalse:[fromIndex := currentSelectionIndex - 1].
  2615     rowFoundIndex := self tableView findFirstRowWithString: searchText
  2616 		from: fromIndex
  2617 		to: 1
  2618 		by: -1
  2619 		ignoreCase:self ignoreCaseHolder value.
  2620     rowFoundIndex isNil ifTrue:[
  2621 	self searchPreviousTextReachBeginning.
  2622 	^self
  2623     ].
  2624     self selectListIndex: rowFoundIndex.
  2625 
  2626     "Modified: / 19-06-2007 / 15:38:16 / Administrador"
  2627 !
  2628 
  2629 searchPreviousTextFromEnd
  2630 
  2631     |searchText rowFoundIndex|
  2632 
  2633     searchText := searchTextView contents.
  2634     searchText isEmptyOrNil ifTrue:[^self].
  2635     self objectsList isEmpty ifTrue:[^self].
  2636     rowFoundIndex := self tableView findFirstRowWithString: searchText
  2637 		from: self objectsList size
  2638 		to: 1
  2639 		by: -1
  2640 		ignoreCase:self ignoreCaseHolder value.
  2641     rowFoundIndex isNil ifTrue:[
  2642 	self searchTextNotFound.
  2643 	^self
  2644     ].
  2645     self selectListIndex: rowFoundIndex.
  2646 
  2647     "Created: / 16-06-2007 / 10:55:43 / Administrador"
  2648     "Modified: / 19-06-2007 / 15:38:26 / Administrador"
  2649 !
  2650 
  2651 searchPreviousTextReachBeginning
  2652     |message|
  2653     message := 'Beginning of list reached, starting from the end'.
  2654     self searchTextRestarted: message.
  2655     Smalltalk beep.
  2656     self searchPreviousTextFromEnd.
  2657 
  2658     "Created: / 16-06-2007 / 11:01:23 / Administrador"
  2659 !
  2660 
  2661 searchTextModifiedHolderChanged
  2662 
  2663     self searchNextTextIncludingCurrentSelection: true.
  2664     self searchTextModifiedHolder setValue: false.
  2665 
  2666 "/Transcript showCR: 'searchTextModifiedHolderChanged: ',(self searchTextHolder value ? '').
  2667 "/Transcript showCR: 'searchTextView contents: ',(searchTextView contents ? '').
  2668 
  2669     "Created: / 15-06-2007 / 18:07:57 / Administrador"
  2670     "Modified: / 16-06-2007 / 09:21:27 / Administrador"
  2671 !
  2672 
  2673 searchTextNotFound
  2674 
  2675     self selectListIndex: 0.
  2676     self searchBarImageInfoLabelHolder value: self warningSearchBarIcon.
  2677     self searchBarInfoLabelHolder value: 'Text not found'.
  2678     self setSearchTextNotFoundColors.
  2679 
  2680     "Created: / 16-06-2007 / 06:51:01 / Administrador"
  2681     "Modified: / 16-06-2007 / 11:43:53 / Administrador"
  2682 !
  2683 
  2684 searchTextRestarted: message
  2685 
  2686     self searchBarImageInfoLabelHolder value: self restartSearchBarIcon.
  2687     self searchBarInfoLabelHolder value: message.
  2688 "/    self setSearchTextNotFoundColors.
  2689 
  2690     "Created: / 16-06-2007 / 11:02:06 / Administrador"
  2691 !
  2692 
  2693 searchTextStarted
  2694 
  2695     self searchBarImageInfoLabelHolder value: nil.
  2696     self searchBarInfoLabelHolder value: ''.
  2697     self setSearchTextFoundColors.
  2698 
  2699     "Created: / 16-06-2007 / 06:54:03 / Administrador"
  2700     "Modified: / 16-06-2007 / 10:07:06 / Administrador"
  2701 !
  2702 
  2703 setSearchTextFoundColors
  2704 
  2705     searchTextView foregroundColor: Color black.
  2706     searchTextView backgroundColor: Color white.
  2707 
  2708     "Created: / 16-06-2007 / 06:28:32 / Administrador"
  2709 !
  2710 
  2711 setSearchTextNotFoundColors
  2712 
  2713     searchTextView foregroundColor: Color white.
  2714     searchTextView backgroundColor: Color lightRed.
  2715 
  2716     "Created: / 16-06-2007 / 06:29:00 / Administrador"
  2717 ! !
  2718 
  2719 !InternationalLanguageTranslationEditor methodsFor:'specs-dynamic'!
  2720 
  2721 columnInRow:row at:colIndex
  2722     |lang|
  2723 
  2724     lang := self languageAtCol:colIndex.
  2725     ^ row atLanguage:lang
  2726 !
  2727 
  2728 getBackgroundForRow:row rowNr:rowNr col:colIndex
  2729     |lang|
  2730 
  2731     colIndex == 1 ifTrue:[^ nil].
  2732     lang := self languageAtCol:colIndex.
  2733     ^ (row atLanguage:lang) isNil ifTrue:[Color red lightened] ifFalse:nil
  2734 !
  2735 
  2736 keyStringAndLanguageSelectionTableColumnDescription
  2737     |spec|
  2738 
  2739     spec := OrderedCollection new.
  2740 
  2741     spec add:(self class keyTableColumn first).
  2742 
  2743     self shownLanguages do:[:lang |
  2744 	|entry|
  2745 
  2746 	entry := self class languageTableColumn first.
  2747 	entry := entry copy replaceAll:#lang with:lang.
  2748 	spec add: entry
  2749     ].
  2750     ^ spec
  2751 !
  2752 
  2753 keyStringInRow:row
  2754     ^ row keyString
  2755 ! !
  2756 
  2757 !InternationalLanguageTranslationEditor methodsFor:'update'!
  2758 
  2759 updateToolVisibility
  2760     | bottomOffset searchBarVisible |
  2761 
  2762     bottomOffset := 0.
  2763 
  2764     searchBarVisible := self searchBoxVisible value.
  2765     searchBarVisible ifTrue:[
  2766 	bottomOffset := bottomOffset - searchBoxView height.
  2767     ].
  2768     translationsPanel layout bottomOffset:bottomOffset-1.
  2769     translationsPanel container notNil ifTrue:[
  2770 	translationsPanel containerChangedSize.
  2771     ].
  2772 
  2773     "Created: / 16-06-2007 / 11:58:25 / Administrador"
  2774 ! !
  2775 
  2776 !InternationalLanguageTranslationEditor methodsFor:'user actions'!
  2777 
  2778 closeSearchBar
  2779 
  2780     self searchBoxVisible value: false.
  2781     self updateToolVisibility.
  2782 
  2783     "Created: / 15-06-2007 / 18:03:05 / Administrador"
  2784     "Modified: / 16-06-2007 / 11:58:52 / Administrador"
  2785 !
  2786 
  2787 exampleLanguageSelectionChanged
  2788 
  2789    self updateExampleLanguageText.
  2790 !
  2791 
  2792 languageTextAccepted
  2793     |nextRowIndex selRow|
  2794 
  2795     selRow := self selectedKeyRow value.
  2796     selRow notNil ifTrue:[
  2797 	keyStringsToLanguageMappings size = selRow
  2798 	    ifTrue:[ self updateLanguageTextModification.]
  2799 	    ifFalse:[
  2800 		nextRowIndex := selRow + 1.
  2801 		self selectedKeyRow value: nextRowIndex]
  2802     ].
  2803 !
  2804 
  2805 pasteOriginalInLanguageText
  2806     <resource: #uiCallback>
  2807 
  2808     | originalText|
  2809 
  2810     originalText := self selectedKey.
  2811     languageEditor selectAll.
  2812     languageEditor pasteOrReplace:originalText.
  2813     self languageTextModifiedHolder value:true.
  2814 !
  2815 
  2816 pastePreviousTranslationInLanguageText
  2817     "Obtain the text from the previous translation and paste it into the languageTextEditor"
  2818 
  2819     | previousLanguageText previousLanguageRow|
  2820 
  2821     previousLanguageRow := dataSetView at:self selectedKeyRow value - 1
  2822 		ifAbsent:[^self].
  2823     previousLanguageText := previousLanguageRow atLanguage: self currentLanguage.
  2824     languageEditor selectAll.
  2825     languageEditor pasteOrReplace:previousLanguageText.
  2826     self languageTextModifiedHolder value:true.
  2827 !
  2828 
  2829 search
  2830 
  2831     self searchBoxVisible value: true.
  2832     self updateToolVisibility.
  2833     searchTextView takeFocus.
  2834 
  2835     "Modified: / 16-06-2007 / 11:58:44 / Administrador"
  2836 !
  2837 
  2838 selectionChanged
  2839 
  2840    self updateOriginalTextModification.
  2841    self updateLanguageTextModification.
  2842    self updateLanguageAndKeySelection.
  2843    self updateExampleLanguageText.
  2844 
  2845    self updateCopyPreviousTranslationButtonEnabled.
  2846    self updatePasteOriginalButtonEnabled.
  2847 
  2848    self originalTextModifiedHolder value:false.
  2849    self languageTextModifiedHolder value:false.
  2850 
  2851    self searchForSimilarTranslation.
  2852 !
  2853 
  2854 showMissingTranslationsOnlyChanged
  2855 !
  2856 
  2857 shownLanguagesChanged
  2858     self keyStringAndLanguageSelectionTableColumnDescriptionHolder
  2859 	value:(self keyStringAndLanguageSelectionTableColumnDescription).
  2860 !
  2861 
  2862 stopApplication
  2863     |p|
  2864 
  2865     (p := monitoredApplication) notNil ifTrue:[
  2866 	p terminate.
  2867     ].
  2868 ! !
  2869 
  2870 !InternationalLanguageTranslationEditor::AccessCollectingPseudoResourcePack methodsFor:'accessing'!
  2871 
  2872 realResourcePack:something
  2873     realResourcePack := something.
  2874 ! !
  2875 
  2876 !InternationalLanguageTranslationEditor::KeyStringsToLanguageMappings class methodsFor:'instance creation'!
  2877 
  2878 new
  2879     ^ self basicNew initialize
  2880 ! !
  2881 
  2882 !InternationalLanguageTranslationEditor::KeyStringsToLanguageMappings methodsFor:'accessing'!
  2883 
  2884 addKey:aKey
  2885     self addKey:aKey sendChange:true
  2886 !
  2887 
  2888 addKey:aKey sendChange:aBoolean
  2889     (keys includes:aKey) ifFalse:[
  2890 	keys add:aKey.
  2891 	aBoolean ifTrue:[ self changed ].
  2892     ]
  2893 !
  2894 
  2895 addKeys:aCollectionOfKey
  2896     keys addAll:aCollectionOfKey.
  2897     self changed.
  2898 !
  2899 
  2900 addLanguage:lang
  2901     (languages includes:lang) ifFalse:[
  2902 	languages add:lang.
  2903 	perLanguageMappings at:lang put:(OrderedDictionary new).
  2904     ]
  2905 !
  2906 
  2907 at:aKey language:language
  2908     ^ (perLanguageMappings at:language) at:aKey ifAbsent:nil
  2909 !
  2910 
  2911 at:aKey language:language put:value
  2912     self addKey:aKey.
  2913     (perLanguageMappings at:language) at:aKey put:value.
  2914     (self rowForKey:aKey) changed
  2915 !
  2916 
  2917 at:aKey language:language put:value sendChange:sendChange
  2918     self addKey:aKey sendChange:sendChange.
  2919     (perLanguageMappings at:language) at:aKey put:value.
  2920     (self rowForKey:aKey) changed
  2921 !
  2922 
  2923 atLanguage: lang putEncoder: aDecoder
  2924 
  2925 ^(self languageInfoAt: lang) at: self encoderKey put: aDecoder
  2926 !
  2927 
  2928 atLanguage: lang putFilename: aFilename
  2929 
  2930 ^(self languageInfoAt: lang) at: self fileNameKey put: aFilename
  2931 !
  2932 
  2933 decoderKey
  2934    ^#decoder
  2935 !
  2936 
  2937 encoderAt:lang
  2938     ^ (self languageInfoAt:lang) at: self encoderKey ifAbsent:[nil]
  2939 !
  2940 
  2941 encoderKey
  2942    ^#encoder
  2943 !
  2944 
  2945 fileNameKey
  2946     ^ #filename
  2947 !
  2948 
  2949 filenameAt:lang
  2950     ^ (self languageInfoAt:lang) at: self fileNameKey ifAbsent:[nil]
  2951 !
  2952 
  2953 keyAt:index
  2954     ^ keys at:index ifAbsent:[nil].
  2955 !
  2956 
  2957 keyAt:index ifAbsent:exceptionalValue
  2958     ^ keys at:index ifAbsent:exceptionalValue.
  2959 !
  2960 
  2961 keys
  2962     ^ keys
  2963 !
  2964 
  2965 languageInfoAt: lang
  2966 
  2967 ^self perLanguageInfo at: lang ifAbsentPut:[Dictionary new]
  2968 !
  2969 
  2970 languages
  2971     ^ languages
  2972 !
  2973 
  2974 languagesInUse
  2975 "Returns a collection of symbols for the languages that have mappings"
  2976 
  2977 ^self languages select:[:each | (self atLanguage: each) notEmpty]
  2978 !
  2979 
  2980 orderedLanguageMappingsAssociationsFor: language
  2981 "Returns a collection of languageMappings associations (alphabetically ordered by keys) "
  2982 ^(self atLanguage: language) associations asSortedCollection:[:a :b | a key < b key].
  2983 !
  2984 
  2985 perLanguageInfo
  2986     ^ perLanguageInfo
  2987 !
  2988 
  2989 perLanguageInfo:something
  2990     perLanguageInfo := something.
  2991 !
  2992 
  2993 removeKey:aKey
  2994     keys remove:aKey ifAbsent:[].
  2995     perLanguageMappings do:[:eachMapping |
  2996 	eachMapping removeKey:aKey ifAbsent:[].
  2997     ].
  2998     self changed.
  2999 !
  3000 
  3001 rowForKey:aKey
  3002     ^ rowPerKey
  3003 	    at:aKey
  3004 	    ifAbsentPut:[InternationalLanguageTranslationEditor::LanguageMappingRow new
  3005 			    key:aKey; mappings:self].
  3006 !
  3007 
  3008 size
  3009     ^ keys size
  3010 ! !
  3011 
  3012 !InternationalLanguageTranslationEditor::KeyStringsToLanguageMappings methodsFor:'enumerating'!
  3013 
  3014 do:aBlock
  3015     keys do:[:eachKey |
  3016 	aBlock value:(self rowForKey:eachKey).
  3017     ].
  3018 ! !
  3019 
  3020 !InternationalLanguageTranslationEditor::KeyStringsToLanguageMappings methodsFor:'initialization'!
  3021 
  3022 initialize
  3023     super initialize.
  3024 
  3025     keys := OrderedSet new.
  3026     languages := OrderedCollection new.
  3027     perLanguageMappings := Dictionary new.
  3028     perLanguageInfo := Dictionary new.
  3029     rowPerKey := Dictionary new.
  3030 
  3031     self addLanguage:#'de'.
  3032     self addLanguage:#'fr'.
  3033     self addLanguage:#'es'.
  3034     self addLanguage:(Smalltalk language).
  3035 
  3036     "/ self initializeDemoMappings.
  3037 !
  3038 
  3039 initializeDemoMappings
  3040     keys add:'open'.
  3041     keys add:'close'.
  3042     keys add:'yes'.
  3043     keys add:'no'.
  3044 
  3045     self addLanguage:#'de'.
  3046     self addLanguage:#'fr'.
  3047 
  3048     self at:'open' language:#'de' put:'öffnen'.
  3049     self at:'close' language:#'de' put:'schließen'.
  3050     self at:'yes' language:#'de' put:'ja'.
  3051     self at:'no' language:#'de' put:'nein'.
  3052     self at:'cancel' language:#'de' put:'abbrechen'.
  3053 
  3054     self at:'open' language:#'fr' put:'ouvrir'.
  3055     self at:'close' language:#'fr' put:'fermer'.
  3056     self at:'yes' language:#'fr' put:'oui'.
  3057     self at:'no' language:#'fr' put:'non'.
  3058 ! !
  3059 
  3060 !InternationalLanguageTranslationEditor::KeyStringsToLanguageMappings methodsFor:'private'!
  3061 
  3062 atLanguage:lang
  3063     ^ perLanguageMappings at:lang
  3064 !
  3065 
  3066 atLanguageIndex:idx
  3067     |lang|
  3068 
  3069     lang := languages at:idx.
  3070     ^ self atLanguage:lang.
  3071 !
  3072 
  3073 mappingAtLanguage:lang
  3074     ^ perLanguageMappings at:lang
  3075 !
  3076 
  3077 mappingAtLanguageIndex:idx
  3078     |lang|
  3079 
  3080     lang := languages at:idx.
  3081     ^ self mappingAtLanguage:lang.
  3082 ! !
  3083 
  3084 !InternationalLanguageTranslationEditor::KeyStringsToLanguageMappings methodsFor:'queries'!
  3085 
  3086 includesKey:aKey
  3087     ^ keys includes:aKey
  3088 !
  3089 
  3090 includesLanguage:lang
  3091     ^ languages includes:lang
  3092 !
  3093 
  3094 indexOfKey:aKey
  3095     ^ keys indexOf:aKey
  3096 !
  3097 
  3098 maxKeySizeForLanguage: lang
  3099 
  3100 ^(self atLanguage: lang) keys inject: 0 into:[:maxSize :each |
  3101     (maxSize < each size and:[each size < 100])
  3102 	ifTrue:[each size]
  3103 	ifFalse:[maxSize].].
  3104 !
  3105 
  3106 searchForSimilarTranslation: aKey in: language
  3107     "Returns a collection of translation associations that corresponds to a quite similar key comparing with aKey"
  3108 
  3109     |similarAssociations|
  3110 
  3111     similarAssociations:=
  3112     (self mappingAtLanguage: language) associationsSelect:[:each |
  3113 	((each key sameAs: aKey)
  3114 	    or:[(aKey asUppercase startsWith: each key asUppercase)
  3115 		or:[((each key asUppercase levenshteinTo: aKey asUppercase)/ each key size) < 0.3
  3116 		]])
  3117 	 and:[each value notNil
  3118 		and:[each value notEmpty]]
  3119     ].
  3120     ^similarAssociations
  3121 ! !
  3122 
  3123 !InternationalLanguageTranslationEditor::LanguageMappingRow methodsFor:'accessing'!
  3124 
  3125 atLanguage:language
  3126     |translation|
  3127 
  3128     translation := (mappings mappingAtLanguage:language) at:key ifAbsent:nil.
  3129     ^ translation isNil ifTrue:nil ifFalse:[translation printString]
  3130 !
  3131 
  3132 columnAt:columnNr
  3133     ^ (mappings mappingAtLanguageIndex:columnNr-1) at: key ifAbsent:nil
  3134 !
  3135 
  3136 key:something
  3137     key := something.
  3138 !
  3139 
  3140 keyString
  3141     ^ key printString
  3142 !
  3143 
  3144 mappings:something
  3145     mappings := something.
  3146 ! !
  3147 
  3148 !InternationalLanguageTranslationEditor::UISpecVisitor methodsFor:'accessing'!
  3149 
  3150 translatedLabels
  3151     ^ translatedLabels ? #()
  3152 ! !
  3153 
  3154 !InternationalLanguageTranslationEditor::UISpecVisitor methodsFor:'visiting'!
  3155 
  3156 visitObject:anObject with:aParameter
  3157     |l|
  3158 
  3159     (anObject isKindOf:UISpecification) ifTrue:[
  3160 	(anObject respondsTo:#translateLabel) ifTrue:[
  3161 	    anObject translateLabel == true ifTrue:[
  3162 		translatedLabels isNil ifTrue:[
  3163 		    translatedLabels := Set new.
  3164 		].
  3165 		l := anObject perform:#label ifNotUnderstood:nil.
  3166 		l notNil ifTrue:[
  3167 		    translatedLabels add:l.
  3168 		].
  3169 	    ].
  3170 	].
  3171     ].
  3172     self visitChildrenOf:anObject.
  3173 ! !
  3174 
  3175 !InternationalLanguageTranslationEditor class methodsFor:'documentation'!
  3176 
  3177 version
  3178     ^ '$Header$'
  3179 ! !