- Choosing the languages supported by the project and the analysis
- Languages supported by the project
- Languages supported by the analysis
- Languages supported by the different project elements
- Writing the UI in the different languages
- Selected translation mode
- Languages that use a specific character set
- Translating specific windows
- Translating messages found in the WLanguage code
- Choosing the language by programming
- Managing specific character sets in HFSQL data files
- Managing the Unicode format and specific character sets
7. Multilingual applications in practice
A multilingual application is an application that can be distributed in several languages. The different application languages will be taken into account during the different development steps.
The main steps for developing a multilingual application are as follows:
- Choosing the languages supported by the project and the analysis.
- Writing the different elements (window, code, etc.) in the different languages of the project.
- Defining the project language by programming.
- Managing specific character sets in the data files.
- Creating the executable and the setup program.
- If the operating system supports several languages (Hebrew, Arabic, Greek, ...), the corresponding character set will be automatically used when typing translations in these languages.
- If your application is a multilingual application, this feature must also be managed in the windows of the user groupware and in the windows for automatic management of HFSQL errors. See the online help for more details.
- The management of Unicode is available in the HFSQL data files, the window controls and the WLanguage code.
Choosing the languages supported by the project and the analysis
Languages supported by the project
The different languages supported by the project are defined in the project description:
- On the "Project" pane, in the "Project" group, click "Description". The project description window appears.
- In the "Languages" tab, you have the ability to add or delete the languages supported by the project.
The selected languages will be proposed for all multilingual resources that can be translated (captions of controls, menu options, help message associated with a control, ...).
When modifying the project languages, the modifications will be automatically taken into account:
- for each new element or object created in the WINDEV editor,
- for each new element or object opened in the WINDEV editor.
The main language corresponds to the language used by default at runtime.
The "Languages" tab of the project description is also used to define the options specific to a language: number, currency, date, ...
The parameters used by default are the ones defined in the Windows language options (accessible from the Windows control panel).
When creating an edit control or a column in a Table control that displays numeric data (number, currency, date, time, etc.), the input mask applied will be the mask defined in the project language options. This option is available in the windows.
At runtime, when an edit control or a a column in a Table control has a mask "Defined by the project", the input/display mask will automatically adapt according to the options selected in the project for the language displayed at runtime.
Remark: The linguistic options are also used to define the writing direction and the character set used ("Various" option).
When creating the executable program, you have the ability to specify the languages that will be taken into account by the executable. You can for example create a different executable program for each language supported by the project.
This feature is used to reduce the executable size.
Languages supported by the analysis
If your project uses an analysis, the languages supported by the analysis are selected in the data model editor. Indeed, the same analysis can be shared among different projects that do not propose the same languages. Therefore, the number of languages defined for the analysis can be greater than the one defined for the project.
To configure the languages supported by the analysis:
- Display the analysis of your project in the editor.
- Open the analysis description window: on the "Analysis" pane, in the "Current element" group, click "Description".
- Select the "International" tab in the description window of the analysis.
The different languages configured in the analysis will be proposed:
- when configuring the shared information of items. The description of the controls linked to items (options, captions, ...) can be typed in the different languages supported by the analysis. When generating a "full application RAD" or a window RAD, this information will be automatically taken into account for all languages common to the analysis and to the project.
- for the information printed in the program documentation (notes of data file or item).
- for the information managed by "Reports and Queries". Indeed, if "Reports and Queries" is supplied with your WINDEV application, you can translate the name of the data file and the name of each item. Therefore, the user will be able to use the names corresponding to his own language when creating his reports and queries. This information can be typed in the "Reports and Queries" tab of the description of data file and items.
Languages supported by the different project elements
By default, the different project elements (windows, reports, code, classes, set of procedures, ...) support the same languages as the project where they have been created.
An element can support more languages than the project (when the element is shared between several projects that support different languages for example).
Writing the UI in the different languages
When the different languages supported by the application have been selected, the information displayed by the application must be translated into these different languages.
Several elements must be taken into account to write the UI in different languages:
- The selected translation mode.
- The supported languages (languages that use a specific character set or not).
- The use of specific windows (user groupware, automatic management of HFSQL errors, report viewer).
- The messages displayed by programming.
Selected translation mode
WINDEV proposes several translation modes:
- Automatic translation of the UI via a specific translation tool, installed on the development computer. This translation is performed in the WINDEV editor.
- Export all the messages via WDMSG and reintegrate them once they have been translated.
Translating the UI
For each element, different multilingual areas are displayed in the description windows. These multilingual areas allow you to enter information in the different languages supported by the project.
To translate this information from WINDEV:
- Display the WINDEV options for configuring the translation options of the software used: on the "Home" pane, in the "Environment" group, expand "Options" and select "General options of WINDEV".
- In the "Translation" tab, you can define:
- the default translation tool (and the transmission mode for the text to translate and for the translated text).
- the source and destination languages.
- If a translation tool is specified, a "Translate" button will be displayed in each element containing information to translate. This button is used to translate the selected text via the specified translation tool.
- To perform the translation, all you have to do is select the text to translate and click the "Translate" button.
Exporting and reintegrating the information to translate
WDMSG is used to extract all project messages (control captions, etc.) and reintegrate them once they have been translated.
Contact PC SOFT Sales Department for more details about the conditions for using this product.
Languages that use a specific character set
If your application supports languages that use specific character sets (Greek, Russian, ...), you must enter the translation of the different messages by using these character sets.
WINDEV allows you to automatically manage the use of specific character sets in the editor.
Indeed, as soon as the edit cursor of the mouse is located in an input area of a language that uses a specific character set, the corresponding input language (character set used by the keyboard) is automatically displayed.
Therefore, if a caption is entered in the Russian section of the caption description, the keyboard will automatically switch to the Russian character set.
Reminder: To use specific character sets, the files corresponding to the desired character sets must be installed in the Windows region settings (control panel).
Translating specific windows
Management of HFSQL errors
By default, the windows for managing the HFSQL errors are supplied in English and in French. To translate them into another language, you must:
- Include the default error windows in your project. The windows are supplied (with their WLanguage code) as example in \Programs\Data\Preset windows\HFSQL - Automatic help windows.
- Customize the management of errors to use the HFSQL windows for error management (HOnError).
- Translate the different messages (see previous paragraph).
Automatic management of errors
By default, the windows for automatic management of errors are supplied in English and in French. To translate them into another language, you must:
- Include the default error windows in your application. These windows are supplied (as well as their WLanguage code) in \Programs\Data\Preset windows\Assertion - Error - Exception.
- Translate the different messages (see previous paragraph).
By default, the user groupware is supplied in English and in French.
To translate an application that uses the user groupware, you must choose a custom integration when configuring the user groupware in your application. Reminder: To configure the user groupware, go to the "Project" pane, "Project" group and click "User groupware".
During the custom integration, the different elements of user groupware will be included via an internal component.
Then, all you have to do is translate these elements when translating the project.
Remark: If necessary, when configuring the user groupware, in the "Execution", tab, select "Manual run": this allows you to display a window for selecting the application language before starting the login window.
By default, the report viewer window is available in English and in French.
To translate this window, you must integrate the windows corresponding to the report viewer into your application. These windows are supplied (as well as their WLanguage code) in \Programs\Data\Preset windows\Preview. See the online help for more details.
Then, all you have to do is translate these windows.
WINDEV offers a default popup menu for Edit and Table controls. This menu allows the user to easily perform several operations.
To translate these menus, you must own WDMSG.
Translating messages found in the WLanguage code
In your code, several WLanguage functions allow you to communicate with the user via character strings. These messages must also be translated into the different languages of your application.
To translate a character string typed in the code editor:
- Select the character string to translate.
- Select "Translate" in the popup menu of the selection. The window for translating messages is displayed.
- Type the translation and validate. The code line is displayed in the code editor:
The flag indicates that translations exist for this character string. Click this flag to display the translation window.
The number (2 in our example) indicates the number of translations typed for this character string.
Remark: To transform all the messages in your code into multilingual messages, go to the "Code" pane, "Languages" group, expand "Translate strings" and select "Convert simple strings into multilingual messages".
Choosing the language by programming
A multilingual application is an application that can be distributed in several languages. The user will be able to choose the runtime language of application. You can for example:
- ask for the runtime language during the first application start
- include an option (menu option or button for example) allowing the user to change the current application language.
Managing specific character sets in HFSQL data files
When an application is used to display or save data in HFSQL data files, this data is typed in the current language.
If the application is used in a country that uses a Latin character set, no specific management is required.
If the application is used in a country that uses a specific character set, this character set must also be supported by the data files. Therefore, the searches, the sorts, ... will be performed according to the selected character set.
Managing the Unicode format and specific character sets
WINDEV proposes two management modes:
- the single charset mode: In this mode, if your application manages languages that use specific character sets (Greek, Korean, ...), you have the ability to change by programming:
- the character set used by all screen fonts (ChangeCharset). This character set can also be used for the data saved in the HFSQL files. See the online help for more details (keyword: Multilingual).
- the language of keyboard used by the application users (ChangeKeyboard).
- the full support of Unicode: This mode is used to manage the non-Latin character sets. In this mode, ChangeCharset and ChangeKeyboard are useless. The change of character set is automatically performed according to the language options defined in the project description. You also have the ability to mix different character sets.
The mode for managing the Unicode format is configured in the options of the current configuration ("Unicode" tab in the description window of the configuration).
If you choose to switch your projects to Unicode, the ANSI/Unicode cohabitation generates some constraints: The data must be translated when switching from an encoding system to another one. Exchanging text strings outside the application must be adapted to take into account the new memory representation of strings (in Unicode, 1 character is coded on 2 bytes while it is coded on 1 byte in ANSI): call to API, read or write to the disk to exchange data, read or write to sockets containing strings, ...
If you choose to switch your projects to UNICODE, a wizard starts automatically to measure the impact of this change.