This refactoring is intended to be used as part of a legacy code modernization project. It is unlikely to be used on a day-to-day basis.
This feature assists in the transformation from string concatenation to the use of a single string with SUBSTITUTE
. This is done because the full sentence in a single string is easier to translate (for internationalization) than the sentence fragmented into two strings.
In some cases, ProRefactor may be unable to automatically suggest changes to the source code. You will be informed of this by a message, and you will be able to make the code change by hand if desired.
In the Review Changes dialog, the Cancel button will reject the current changes and stop any further processing.
Comments
implicit concatenation not dealt with
The "Message" statement does implicit string concatenation.
E.g.
MESSAGE "Hello" customer.first-name "! How are you?" VIEW-AS ALERT-BOX.
would display something like "Hello Bob ! How are you?".
The SUBSTITUTE refactoring currently does not deal with these cases, but it should (I'm reviewing/translating old code and they are abundant!).
The refactoring should offer the following:
MESSAGE SUBSTITUTE("Hello &1 ! How are you?", customer.first-name) VIEW-AS ALERT-BOX.
Re: implicit concatenation not dealt with
That's a good one David, thanks for posting that. It would be a great enhancement. I think it would be fun to work on, but unfortunately I'm swamped with customer contract work at the moment. I'd be happy to provide email help to anybody who wants to take a shot at it though.