User's Guide

Displaying translated strings

After you translate the strings in a .tra file, you can build an .mpr file for the other language, reconfigure your system for the other language, and then display the translated strings in your application.

Building .mpr files for translated strings

To take the translated strings and add them to an .mpr file, change and evaluate the sample expression in the Building Translated MPR files window, which essentially provides:

AbtNlsTranslatedMprBuilder new
  buildNewBinaryMpr: '<new .mpr file>'
  fromExistingBinaryMpr: '<original .mpr file>'
  fromTraFilename: '<.tra file>'

For AddressApplication, where the German translation file is aaaddg10.tra and you want the new .mpr file to have the name aaaddg10.mpr, you evaluate:

AbtNlsTranslatedMprBuilder new
  buildNewBinaryMpr: 'aaaddg10.mpr'
  fromExistingBinaryMpr: 'aaadde10.mpr'
  fromTraFilename: 'aaaddg10.tra'
Tip icon
To include several .tra files in one .mpr file, use fromMultipleTraFilenames: #(<'first .tra file 'second .tra file'>).

This code is useful for translating different parts of a .tra file at different times. For example, new messages may have been added after your first round of translations. Since the .tra creation process is really an overlay process, you can overlay (that is, translate) parts or all of a given .tra file. If you find it easier to manage your translation tasks by breaking up your .tra files then using this code will allow you to build the new translated .mpr without first manually gluing all of the .tra pieces back together. Here are the ground rules for doing this:

Using a different .mpr file

To get VisualAge to use a different .mpr file for your application, ensure that VisualAge can find the file in the path designated in abt.ini, then select NLS > Rebind Image Strings from the Tools menu of the Transcript.

So VisualAge can find the file, the sixth character of the .mpr file name must correspond with the language setting for VisualAge and for the country setting of your workstation. Setting language preferences lists the characters that VisualAge uses in the sixth character position to specify language settings. To change the language settings for VisualAge, you might need to add language=<language> and territory=<country> to the abt.ini file in the main VisualAge directory; and then restart VisualAge.

Tip icon
To quickly reconfigure VisualAge so it uses the translated .mpr file, rename the translated .mpr file to the file name your VisualAge system looks for, place the file where VisualAge can find it, and evaluate the expression. By renaming the file, you don't need to change the abt.ini file or your workstation's country settings. For AddressApplication, you might backup the .mpr file that VisualAge recognizes and give the german .mpr file that name. For example, rename aaaddg10.mpr to aaadde10.mpr. Then, select NLS > Rebind Image Strings from the Tools menu.

Displaying the translated text in your application

When you open the view in a VisualAge editor, the strings might still appear in the original language. To see the translated strings, open the view through an openWidget connection, or through a script like the following:

openAddressApplication
  AddressView new openWidget

Or, simply Execute the following code in the System Transcript window:

AddressView new openWidget.

Here's what AddressView looks like in German:
AddressView in German


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]