ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Controls, pages and windows / Multilingual functions
  • Overview
  • Defining the application language programmatically
  • Default language
  • Changing the language programmatically
  • Tip
  • Mechanism of preferred languages for the external components
  • Principle
  • Sequence of preferences
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Overview
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 the application language programmatically

Default language

When running the project, the default language is selected in the project options:
  • on the "Project" tab, in the "Project" group, click "Description".
  • select the "Languages" tab.
  • select the default language in the list of project languages and select "Default language" in the context menu.
The change of language is performed programmatically.

Changing the language programmatically

To change language through programming:
  1. Call Nation and pass the selected language as parameter. The selected language will be taken into account by the first WLanguage function called after Nation and for all the windows, pages and reports that will be opened thereafter.
  2. Call LoadError to load the message error file of the components (WD*.DLL files) in the selected language. The error message file has a WDM extension.
    Remarks:
    • If a message file is associated with the language chosen in the project description, there is no need to use LoadError.
      Reminder The message file is defined in the "Miscellaneous" tab of the project description.
      Reminder: to display the project description, under the "Project" pane, in the "Project" group, click on "Description". Select the "Languages" tab.
    • The error messages of the components are in English by default. They can be translated with WDINT.EXE. WDINT is an additional tool. Contact PC SOFT Sales Department for more details about the conditions for using this program.
  3. If your application manages languages using specific character sets (Greek, Korean, etc.)change by programming:
Example of initialization process of project:
// La langue est choisie avec le sélecteur SEL_ChoixLang
SWITCH SEL_ChoixLang
	CASE 1 : // Français
		Nation(nationFrench)
	CASE 2 : // Anglais
		Nation(nationEnglish)
		IF LoadError("ANGLAIS.WDM") > 0 THEN
			Error("Fichier des messages non trouvé. ",...
				"Les messages seront affichés en français.")
		END
	CASE 3 : // Espagnol
		Nation(nationSpanish)
		IF LoadError("ESPAGNOL.WDM") > 0 THEN
			Error("Fichier des messages non trouvé. ",...
			"Les messages seront affichés en français.")
		END
	CASE 4 : // Grec
		Nation(nationGreek)
		IF LoadError("GREC.WDM") > 0 THEN
			Error("Fichier des messages non trouvé. ",...
			"Les messages seront affichés en français.")
		END
		ChangeCharset(charsetGreek)
		ChangeKeyboard(charsetGreek)
END
Java To change the language through programming, simply call Nation with the selected language as parameter. The selected language will be taken into account by the first WLanguage function called after Nation and for all the windows that will be opened thereafter.

Tip

Several methods can be used to choose the project language:
  • Stored in a parameter file. In this case, the change of language can be performed in the initialization process of the project and it will effective from the first window or page of the project.
  • Chosen by a menu option. In this case, the menu will be displayed in the default language and the change of language will be performed when the next window or page is opened.
Mechanism of preferred languages for the external components
WINDEVWindows

Principle

If an external component used in the project supports less languages (or different languages) than the project, the mechanism of preferred languages is used to display the desired information (coming from the external component) in a language close to the desired one.
Example An external Component window has been translated into French, English and Russian. A menu option in the application that uses the external component allows this window to be displayed in German.
The mechanism of preferred languages searches for the German language, the English language and the American language.
In our example, the window will be displayed in English.
Advantage if you're using an external Component that doesn't support the same languages as your application, a translation will always be displayed (even if it doesn't exactly match the language you want).
Note It is also possible to translate the external Component interface into the desired language. For more details, see Translating the external components.
WINDEVWindows

Sequence of preferences

The requested language is searched by default.
If this language is not found, English translations are first searched and displayed.
If English is not associated with the element, American is searched and displayed.
Special cases:
  • If English is searched and not found, American will be searched.
  • If American is searched and not found, English will be searched.
  • If Canadian French is searched and not found, French will be searched, then American and then English.
  • If Portuguese is searched and not found, Brazilian Portuguese will be searched, then English and then American.
  • If Brazilian Portuguese is searched and not found, Portuguese will be searched, then English and then American.
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 03/28/2025

Send a report | Local help