Defining binary files to hold language-specific strings
Each VA Smalltalk application (software component) includes a special class that has the same name as the application itself. For example, in AddressApplication, which is described in Using a Form Input Checker part and modified in Adding messages, there is a class called AddressApplication. Open a Script Editor on the application class, and switch to its class scripts.
To enable VA Smalltalk to create binary files that hold language-specific strings, add a class script called abtExternalizedStringBuildingInfo. VA Smalltalk uses the script to make .mpr files for the application. The script must answer a three-element array that defines how VA Smalltalk should externalize strings in the application's user interface. The script looks like the following:
abtExternalizedStringBuildingInfo
^Array with: <'base MPR file name'> "Name without .mpr extension"
with: <true or false> "Platform-specific?"
with: <true or false> "Include subapplications?"
<'base MPR file name'> defines the name, without the .mpr extension, of the .mpr file for the application. You can use a special wildcard character (?) in the file name to reserve one character position to identify the national language. When users install your application, a country character is substituted for the wildcard expression to determine the correct file to load. The country character that is substituted is determined by the language-mapping section of the abtrules.nls file, and the operating system's country settings.
Tip icon
To illustrate this, browse implementors of abtExternalizedStringBuildingInfo. Notice that in VA Smalltalk methods, which begin with abt, the sixth character position of the base .mpr file name has a ? character. Because VA Smalltalk is translated into several national languages, VA Smalltalk uses a ? in the sixth character position to designate that an .mpr file is not language-specific. Also notice that .mpr files provided with VA Smalltalk have a letter such as e, b, e, f, and so on in the sixth character position of the files' names. The abtrules.nls file shipped with VA Smalltalk specifies a country character, such as e for English-speaking United States, to go in the sixth character position of .mpr file names.
See Setting language preferences for more information about the abtrules.nls file.
For the second array element, the boolean <true or false> defines whether the strings are platform-specific. true specifies that the strings apply only to the platform on which VA Smalltalk is running. Thus, if you are using VA Smalltalk for Windows, the generated file will have the extension .win in its name. false specifies that the strings are not platform-specific, resulting in a file that has the extension .mpr in its name. For most applications, you likely want false.
For the third array element, <true or false> defines whether strings for subapplications of the application should go into the .mpr file. true specifies that strings for the user interface of subapplications be included. false specifies that strings for the user interface of only the named application be included.
Thus, to translate the user interface for AddressApplication, you might add the following script to the Smalltalk application class AddressApplication:
abtExternalizedStringBuildingInfo
^Array with: 'aaadd?10' "Not language-specific MPR"
with: false "Not platform-specific"
with: true "Include subapplications"
Last modified date: 07/22/2020