Posted by & filed under Tips.

We are busy internationalizing important messages in Understand 2.0 so that they can be translated into Japanese. This involves a lot of changes that are identical. For instance, all translatable strings have to be turned into functions that go through a translation function “tr()” that will table lookup the string to the corresponding Japanese translation.

So take for instance this section of code:

procedure Buffer_Demo is
   EOL  : Character renames ASCII.LF;
   Text : constant String
     := “Four score and seven years ago our fathers brought forth,” & EOL &
        “upon this continent, a new nation, conceived in liberty,” & EOL &
        “and dedicated to the proposition that `all men are created equal’.”;

I’ve got to make it look like this:

procedure Buffer_Demo is
   EOL  : Character renames ASCII.LF;
   Text : constant String
     := tr(“Four score and seven years ago our fathers brought forth,”) & EOL &
        tr(“upon this continent, a new nation, conceived in liberty,”) & EOL &
        tr(“and dedicated to the proposition that `all men are created equal’.”);

Fortunately, Understand 2.0 can record editor macros that make repeated tasks easy and possibly fun.

Here is how…

Ctrl-Alt-M toggles recording on / off. This is also available from the Tools-> menu.
Ctrl-M       plays the recorded macro.  Also available from the Tools-> menu.

I start recording:


The first thing I do is use the editors fast find to find the “.  I do this with:

ctrl-f “  ESC  <-

Or, in English… Control-F, double quotation mark, Escape, left arrow.This places me to the left of a “

I then add my function text:


Now I need to find my closing quotation mark:

Ctrl-F “  Ctrl-F  ESC ->

Or, in English… Control–F, double quotation mark, Control-F, Escape, Right Arrow. This places me to the right of the closing quotation. 

I then close out the function and stop recording:


Now anytime I hit “Ctrl-M” it will find a left quotation mark and put tr() around the string.

Note: For a simple one like this I could probably also use Search->Find and Replace.