- 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
- UI in different languages
- Translation method
- Languages that use a specific character set
- Translating specific windows
- Translating WLanguage code messages
- Choosing the language through programming
- Defining specific character sets in HFSQL data files
- Unicode and specific character sets
7. Multilingual applications in practice
A multilingual application can be distributed in multiple languages. The different languages of the application 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 programmatically.
- 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, etc.), the corresponding character set will be automatically used when translating to these languages.
- If your application is multilingual, this feature must also be supported in the User Groupware and the automatic HFSQL error handling windows. For more details, see the online help.
- Unicode is available in the HFSQL data files, window controls and 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" tab, in the "Project" group, click "Description". The project description window appears.
- In the "Languages" tab, you can add or delete the languages supported by the project.
The selected languages will be available for all multilingual resources that can be translated (captions of controls, menu options, help messages associated with a control, etc).
When changing the project language, changes 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 also allows you to define all language-specific options: number, currency, date, etc.
The parameters used by default are the ones defined in the Windows language options (accessible from the Windows control panel).
When an Edit control or a Table control column that shows numeric data (number, currency, date, time, etc.) is created, it will automatically use the input mask defined in the project language options. This option is available in the windows.
At runtime, when an Edit control or 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 language options also allow you to define the writing direction and the character set used ("Miscellaneous" option).
When creating the executable file, you can specify the languages that will be included in it. You can create a different executable file 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. The same analysis can be shared between different projects that do not use the same languages. Therefore, the analysis might use more languages than the project.
To configure the languages supported by the analysis:
- Open the project analysis in the editor.
- Open the analysis description window: on the "Analysis" tab, in the "Current element" group, click "Description".
- Select the "International" tab in the description window of the analysis.
The different languages set in the analysis will be available:
- when configuring the shared information of the items. The description of the controls bound to the items (options, captions, etc.) can be entered in the different languages supported by the analysis. When generating a "full RAD" or window RAD, this information is automatically used for all languages common to the analysis and the project.
- for the information printed in the technical documentation (notes of data files or items).
- for the information managed by "Reports and Queries". If "Reports and Queries" is provided with your WINDEV application, you can translate the names of the data files and the items. Users will be able to use the names in the desired language when creating their reports and queries. This information can be entered in the "Reports and Queries" tab of the data file and item description.
Languages supported by the different project elements
By default, the different elements of the project (windows, reports, code, classes, sets of procedures, etc.) support the same languages as the project in which they were created.
An element can support more languages than the project (when the element is shared between several projects that support different languages, for example).
UI in 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 create the UI in different languages:
- The selected translation mode.
- The supported languages (with or without a specific character set).
- The use of specific windows (User Groupware, automatic HFSQL error handling, report viewer, etc.).
- The messages displayed through programming.
WINDEV includes different 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
The description window of each element has different tabs with multiple multilingual areas. These multilingual areas allow you to enter information in the different languages supported by the project.
To translate this information from WINDEV:
- Go to the WINDEV options to configure the translation options of the software used: on the "Home" tab, in the "Environment" group, expand "Options" and select "General options of WINDEV".
- In the "Translation" tab, you can define:
- the default translation tool.
- 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.
- Select the text to be translated and click "Translate".
Exporting and reintegrating the information to translate
WDMSG is a stand-alone tool used to extract all the messages of a project (control captions, tooltips, 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, etc.), the different messages must be translated using these character sets.
WINDEV allows you to automatically manage the use of specific character sets in the editor.
When the text cursor is located in the input area of a language that uses a specific character set, the corresponding input language (character set used by the keyboard) is automatically enabled.
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
Handling HFSQL errors
By default, HFSQL error handling windows are available in English and French. To translate them into another language, you must:
- Include the default error windows in your project. You will find examples of these windows (with their WLanguage code) in \Programs\Data\Preset windows\HFSQL - Automatic help windows.
- Customize error handling to use HFSQL error handling windows (HOnError).
- Translate the different messages (see previous paragraph).
Automatic error handling
By default, automatic error handling windows are available in English and French. To translate them into another language, you must:
- Include the default error windows in your application. You will find examples of these windows (with their WLanguage code) in \Programs\Data\Preset windows\Assertion - Error - Exception.
- Translate the different messages (see previous paragraph).
By default, the User Groupware is available in English and 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" tab, "Project" group and click "User Groupware".
During the custom integration, the different elements of the User Groupware are included via an internal component.
You will only need to translate these elements when you translate the project.
Remark: If necessary, when configuring the User Groupware, in the "General", tab, select "Manual start": this allows you to display a window to select the language of the application before 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. You will find examples of these windows (with their WLanguage code) in \Programs\Data\Preset windows\Preview. For more details, see the online help.
Then, all you have to do is translate these windows.
WINDEV includes a default context menu for Edit and Table controls. This menu allows users to easily perform several operations.
To translate these menus, you must have WDMSG.
Translating WLanguage code messages
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 be translated.
- Select "Translate" in the context menu of the selection. The window for translating messages is displayed.
- Type the translation and validate.
- The line of code is displayed in the editor. An icon appears to the right of the translated message. This icon indicates that the current message has multiple languages. The icon allows you to quickly access the translation window.When the icon is hovered over, a tooltip shows the different translations found for the string in all the project languages.
Remark: To convert all the messages in your code into multilingual messages, go to the "Code" tab, "Languages" group, expand "Translate strings" and select "Convert simple strings into multilingual messages".
Choosing the language through programming
A multilingual application can be distributed in multiple languages. The user will be able to choose the language used by the application at runtime. You can for example:
- prompt the user to choose the runtime language the first time the application is started
- include an option (menu option or button, for example) to allow users to change the language while the application is running.
Defining specific character sets in HFSQL data files
When an application displays or saves 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 configuration 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. This means that search, sort and other operations will be performed according to the selected character set.
Unicode and specific character sets
WINDEV includes two modes:
- single charset mode ("Use ANSI strings at runtime"): In this mode, if your application includes languages that use specific character sets (Greek, Korean, etc.), change the following elements through programming:
- the character set used by all the fonts used on the screen (ChangeCharset). This character set can also be used for the data saved in the HFSQL files. For more details, see the online help (keyword: Multilingual).
- the language of the keyboard used by the application users (ChangeKeyboard).
- full Unicode support ("Use UNICODE strings at runtime"): This mode can be used for non-Latin character sets. In this mode, ChangeCharset and ChangeKeyboard don't have any effect. The character set is automatically changed based on the language options defined in the project description. You can also combine different character sets.
The Unicode options can be set in the current configuration ("Unicode" tab in the configuration description window).
If you change your projects to Unicode, the ANSI/Unicode combination generates some constraints: Data must be converted when changing from one encoding system to another. Any data exchange must be adapted depending on how strings are represented in memory (in Unicode, 1 character is encoded on 2 bytes, while in ANSI, it is encoded on 1 byte): for example, calls to APIs, read from or write to the disk to exchange data, read from or write to sockets containing strings, etc, ...
If you change your projects to UNICODE, a wizard starts automatically to measure the impact of this change.