Localizing the VDA Tools
PV‑WAVE uses resource and string files to isolate the dynamic aspects of applications in files that are distinct from the code. For instance, the labels that appear in VDA Tools menus are maintained in separate resource files, and the application accesses these resource files as they are needed. Similarly, error messages and other dynamic text information not directly related to widgets are maintained in separate string files. String and resource files greatly simplify the process of localizing software applications.
The process of translating, or localizing, an application is described in the following sections.
Copy and Translate Resource and String Files
1. Make a copy of the following directory, including its contents and all of its subdirectories:
(UNIX) <wavedir>/xres/american/*
(WIN) <wavedir>\xres\american\*
Where <wavedir> is the main PV‑WAVE directory.
2. Give the new local-language directory tree a name that reflects the local language. For example: japanese.
3. Translate the labels and text strings contained in the resource and string files in the new local-language resource directory tree. By convention, string files end in .ads, and resource files end in .ad.
note | Be sure that you can select a font that contains the special characters you wish to use. For special characters to be displayed correctly, a font containing those characters must be selected. |
How PV-WAVE Determines the Locale
PV‑WAVE determines which locale (wave/xres subdirectory) to use when loading resource and string files at run time. It does this by examining the value of the !Lang system variable.
To set the initial value of !Lang (the locale), PV‑WAVE follows this procedure:
1. Looks at the value of the WAVE_LANG environment variable.
2. If step 1 fails, looks at the value of the locale that is defined by the operating system.
3. If steps 1 and 2 fail, uses a default locale.
The rest of this section explains these steps in detail. Using the information in this section, you can set the default locale of your entire PV‑WAVE installation, or override the default locale for a particular PV‑WAVE session.
The WAVE_LANG Environment Variable
To determine the locale to use, PV‑WAVE first checks the environment variable WAVE_LANG.
When PV‑WAVE starts, the environment variable WAVE_LANG is examined. If this environment variable is set and if the directory:
(UNIX) <wavedir>/xres/$WAVE_LANG
(WIN) <wavedir>\xres\%WAVE_LANG%
exists, then WAVE_LANG is used to set the !Lang system variable and, thus, the system locale. For instance, if WAVE_LANG is set to japanese, then the resource and string files for PV‑WAVE applications will be loaded from the area:
(UNIX) <wavedir>/xres/japanese
(WIN) <wavedir>\xres\JAPANESE
note | Use WAVE_LANG primarily to override the default system locale. For example, if the default system locale is japanese, you can use the American English resources by setting WAVE_LANG to american. |
The Operating System Locale Setting
If the WAVE_LANG variable is not set, or if its value cannot be used (for example, because a subdirectory named $WAVE_DIR/xres/$WAVE_LANG does not exist), then the operating system locale setting is retrieved and used to determine the proper locale for PV‑WAVE.
The operating system locale setting is determined by the value of an environment variable. If necessary, PV‑WAVE examines this variable and uses its value as a key into a string file called locale.ads, which resides in the xres directory.
The locale.ads file contains name/value pairs, with the name of the operating system locale on the left, followed by a colon, followed by the name of the xres subdirectory containing the localized resource files. For example:
Japanese_Japan.932: japanese
could be used to specify Japanese as the locale. In this case, if the operating system locale is Japanese_Japan.932 (the standard Japanese locale value for Windows systems), then PV‑WAVE will set its default locale to japanese.
To check the default locale setting for your operating system:
In UNIX, enter the following command at the operating system prompt:
echo $LANG
In Windows, enter the following command at the WAVE> prompt:
PRINT, WIN32_LOCALE()
Default Locale Setting
If PV‑WAVE is unable to set the locale using the WAVE_LANG environment variable or the locale.ads file, then the default locale american is used. You can change this default for the entire PV‑WAVE installation by modifying the following line in the locale.ads file:
DEFAULT: american
For example, to change the default locale for your PV‑WAVE installation to japanese, change this line to:
DEFAULT: japanese