Building .mpr files
To build an .mpr file, change and evaluate example code shown in the NLS Workspace - MPR Generation and Archival window. To open the window, select NLS > Maintenance > Workspace: MPR Generation and Archival from the Tools menu of the Transcript.
The expression you evaluate to build an .mpr file is as follows:
<application name> abtNlmGenerateMpr.
For AddressApplication, evaluate:
AddressApplication abtNlmGenerateMpr.
VA Smalltalk writes the .mpr file to your main VA Smalltalk directory. The strings in the .mpr file are in the language currently displayed by your system.
To build an .mpr file and write it to a specific directory using a specific language character, use the following:
<application name> abtNlmGenerateMprIntoDirectory: <directory>
languageChar: <language character>.
You can evaluate the expression whenever you need to update an .mpr file for the application. Re-evaluating the expression overwrites the contents of an existing .mpr file.
Binding image strings
After you build an .mpr file, rebind the strings in your image. To do this, select NLS > Rebind Image Strings from the Tools menu of the Transcript.
So the system finds your .mpr file when rebinding image strings, the .mpr file must be in the main VA Smalltalk directory or in a directory defined in Locale nlsPath. The system searches first in the main VA Smalltalk directory and then searches each path in Locale nlsPath.
Making translatable files out of .mpr files for testing
After you have an .mpr file, to make translatable source you must evaluate an expression that converts the .mpr file into a translation (.tra) file. A .tra file is a simple text file that can be translated to another national language.
The Preparing Translation (*.tra) files window lists three expressions for making a .tra file. For most occasions, you will generate a .tra file from an application and use the expression:
AbtNlsTraFileDumper new
dumpFromApplication: <application name>
toTraFilename: <'.tra file name'>
This expression generates fully qualified names for items listed in the .tra file.
For AddressApplication, where its .mpr file is aaadde10.mpr and you want the translation file to have the name aaadde10.tra, you evaluate:
AbtNlsTraFileDumper new
dumpFromApplication: AddressApplication
toTraFilename: 'aaadde10.tra'
 
Tip icon
To generate .tra files for more than one application, change the expression so it resembles the following:
Transcript execLongOperation: [
#(
MyApp1
MyApp2
) do: [ :sym |
| app |
(app := Smalltalk classAt: sym) isNil
ifTrue:[ Transcript cr; nextPutAll: sym, ' is not loaded.']
ifFalse:[
| tra |
tra := app abtExternalizedStringBuildingInfo first
collect: [:ch | ch = $? ifTrue:[$e] ifFalse: ch]].
tra := tra, '.tra'.
Transcript cr; nextPutAll: 'Generating ', tra.
AbtNlsTraFileDumper new
dumpFromApplication: app
toTraFilename: tra
]]]
Another of the expressions generates a .tra file from a catalog (.cat) file. Strings from Smalltalk dialogs such a message prompter are stored in a .cat file. If you have to translate the text in a .cat file, you use the expression that uses methods in the class AbtNlsEnvyCatalogTraFileDumper.
Still another expression generates a .tra file from an .mpr file. Use this expression only when you cannot get to the code from which the original .mpr was created. If possible, always generate .tra files from applications rather than from .mpr files.
When you evaluate these expressions, VA Smalltalk writes to the specified .tra files all strings in your applications' code that pertain to messages, graphical user interface (GUI) parts, and pool dictionary entries.
If you need to update a .tra file, you can evaluate an expression again and, when prompted, confirm that you want to overwrite the existing .tra file.
Last modified date: 05/14/2020