Multiple-Language Resource File (Sample Program)New in April 2017. |
The multiple-language resource file sample program demonstrates how to produce a multiple-language application based on a multiple-language resource file. The application's resources are developed in just one language (single-language resource file). By translating this single-language resource file with RC-WinTrans, a multiple-language resource file and multiple-language application can be created. The sample (source code) was created with a Microsoft Visual Studio 2010 C++ project. The graphical user interface (GUI) language of the compiled application can be changed at run-time.
The basic concept is that an application's single-language resource file will be translated with RC-WinTrans into several languages. RC-WinTrans generates the target resource files- one for each language- on command. These translated resource files will be included ("#include" statement) in the source (original) resource file. The source resource file gets one include statement per translated resource file.
NOTE: The file concept used in this sample is not for creating one single multiple-language resource file. Instead, two translated target files (for German and Japanese) are created by RC-WinTrans. These target files will be included (with an "#include" statement) in the source file. After being compiled by the resource compiler, the result is the same as having the resource in just one file: a multiple-language resource file. To see what this looks like, open the "scribble.rc" source resource file with a text editor and view the two include statements for the German and Japanese resource files: #include "TargetRC\ScribbleGER.rc" // German resource file #include "TargetRC\ScribbleJAP.rc" // Japanese resource file
Advantages An application can be developed in just one set of resources, in one single language. Resources in additional languages will be generated by RC-WinTrans. A developer only has to maintain the resources of a single-language resource file (here: "scribble.rc"). RC-WinTrans’ change control permits the source resource file to be changed and expanded and the target resource files to be kept up-to-date with a minimum of work.
To edit the translations for this multiple-language "Scribble" sample, open the source resource file "SCRIBBLE.RC" from RC-WinTrans' Samples page.
|
Figure 1: File concept. The source resouce file of the Scribble application (scribble.rc) with two include statements for the translated resouce files "ScribbleGER.rc" (German) and "ScribbleJAP.rc" (Japanese). |
Primary files of the "Scribble.rc" translation project:
In general, RC-WinTrans makes no changes to a source file. The include statements in the source file, one for each localized file (target file), must be added manually by the developer using (here in this sample) MS Visual Studio.
EXAMPLE: Include statements in the source file "Scribble.rc" for two localized files- German ("ScribbleGER.rc") and Japanese ("ScribbleJAP.rc").
Because a localized target file is a copy of the source file, any include statements in the source file are also contained in the target file. Include statements should be specified as to be "omitted from the target file" to avoid recursive inclusion at the time of compilation.
Procedure for avoiding duplicate include statements in the target file(s):
See also: "Omitting Resources from Target Files."
SUGGESTION: Use the "omit from target file" designation for images as well. This prevents the images from being included in the target files a second time (since the images are already present in and will be taken over from the source at the time of compilation).
In the sample there is one translated bitmap- this bitmap has not been omitted.
|
Figure 2: File "includes" listed and selected in the main window's Text Table view. |
Figure 3: The file includes after applying the Omit from Target Language command for the German and Japanese target languages. |
|