Tools__InternationalLanguageTranslationEditor.st
author Patrik Svestka <patrik.svestka@gmail.com>
Wed, 14 Nov 2018 12:07:51 +0100
branchjv
changeset 3630 5e718e0a754e
parent 3312 84084dd13f11
permissions -rw-r--r--
Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present

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