Tools__InternationalLanguageTranslationEditor.st
author Claus Gittinger <cg@exept.de>
Mon, 14 Oct 2019 20:55:04 +0200
changeset 3787 7b01435dcf25
parent 3764 e140f846dccf
permissions -rw-r--r--
#FEATURE by exept
class: ShowMeHowItWorks
added:
#do:from:
#do:from:withUI:
#doStream:from:
#drag:toComponent:dropAt:
#expand:
#findComponent:ifMultiple:
#findComponent:inAllApplications:ifMultiple:
#label:
#movePointerToComponent:rightBottomOffset:
#movePointerToComponent:rightOffset:
removed: #nextCommand
comment/format in:
#do:
#findComponent:
#waitFor:timeout:
changed:
#do:withUI:
#doCommand:
#doStream:
#press:
#release:
#select:
#selectIndex:in:

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