Is there an other way to refactor symbols.
At the moment I have to define a method with the same name as my Symbol
saving it. Refactor the symbol method and deleting the method. Most
times I like to refactor a bunch of symbols. So this way is very
unconvinient.
Any suggestions appriciated.
thanks
cjb
Maybe you should use PoolDictionaries (and write keys) instead of
symbols. I don't say that PoolDictionaries are the best solution but
are comparable with your current implementation.
Another solution we have implemented is using Strings, but no as
placeholders. String was extended with #translated implementing the
translation logic for the current language of the user.
i.e.
'Helo' translated -> If the user has english as language, #translated
answers 'Hello', but 'Hola' if the user is in spanish.
'I'm <1d> years old' translated expandMacrosWith: 20 (on my dreams) ->
'Tengo 20 años' if the user is in spanish
All the translations are mantained in a LookupTable that can be
exported in xml.
Additionally we mark all the translatable strings with the character @
as the first character so find all translatable strings
is as easy as "String allInstances select: [:each | each firstOrNil ==
$@]".
Using this technique you should remove @ as the first character in the
#translate implementation of String (If you mask @ with @ i.e.
'@@domain' you ends with '@domain' so there are no problems).
Cheers
Sebastian Calvo
On 12 dic, 07:35, "Christoph J. Bachinger" <bachinger.softw...@t-
You can use the Code Rewriter if you want to rename the symbols. For
example, to rename #foo to #bar: select your packages, switch to the
code rewriter, enter #foo at the top, #bar at the bottom, and hit the
Replace button. This will open another window with all of the potential
changes that you can accept or reject.
John Brant
How to select the packages or only one Package. Normaly im using the
Sytembrowser to code for my application. So my Package is already
selected. If I switch to the Code Rewriter I can change the #foo to #bar
and hit the Replace button. But the change is only in this method and
not in the Package or Class.
cjb
John Brant schrieb:
> Maybe you should use PoolDictionaries (and write keys) instead of
> symbols. I don't say that PoolDictionaries are the best solution but
> are comparable with your current implementation.
The symbols are the keys in the dictionary of the langugage instance.
>
> Another solution we have implemented is using Strings, but no as
> placeholders. String was extended with #translated implementing the
> translation logic for the current language of the user.
> i.e.
>
> 'Helo' translated -> If the user has english as language, #translated
> answers 'Hello', but 'Hola' if the user is in spanish.
> 'I'm <1d> years old' translated expandMacrosWith: 20 (on my dreams) ->
> 'Tengo 20 a�os' if the user is in spanish
>
> All the translations are mantained in a LookupTable that can be
> exported in xml.
>
> Additionally we mark all the translatable strings with the character @
> as the first character so find all translatable strings
> is as easy as "String allInstances select: [:each | each firstOrNil ==
> $@]".
> Using this technique you should remove @ as the first character in the
> #translate implementation of String (If you mask @ with @ i.e.
> '@@domain' you ends with '@domain' so there are no problems).
The idea is not bad. But I don't like to change the horse at the end of
a development.
Thanks
cbj
> How to select the packages or only one Package. Normaly im using the
> Sytembrowser to code for my application. So my Package is already
> selected. If I switch to the Code Rewriter I can change the #foo to #bar
> and hit the Replace button. But the change is only in this method and
> not in the Package or Class.
You'll need to deselect your class/method. Otherwise, it will run on
only the class/method that you have selected.
John Brant
Sorry to be so annoying to you, but I see only one method in the list
while if I do a shift F12 I see much more senders of my Symbol but this
is in a Methodbrowser and not in the code rewriter methodlist.
Deselection the only message highlights all menu entries without "Accept
all changes". Selecting it does only a change in the one method listed.
cjb