- Multilingual message migration wizard
- Migration wizard
- Messages used multiple times
Multilingual messages: Conversion to new format in version 27
WINDEV, WEBDEV and WINDEV Mobile have included multilingual project support in many previous versions.
Until version 26, the code editor handled these multilingual messages based on a "MessTranslate identifier". In older versions, this identifier could be used with the WLanguage MessTranslate function. This function is now kept for compatibility only and should not be used anymore.
The "MessTranslate identifier" mechanism had some technical limitations for operations such as:
- merging branches via the SCM,
- handling messages from templates,
- handling "linked" multilingual messages which could cause errors in applications...
To overcome these limitations, a new mode was introduced in version 27
. In projects developed with a previous version, a specific wizard will help you switch to this new mode.
Multilingual message migration wizard
Before starting the multilingual message migration wizard:
- Reintegrate all translations "in progress". After the migration, the translation files will no longer be compatible.
- Check in all the elements shared via the SCM (recommended).
- Enable errors for shared messages at the project level:
- Open the project description window: on the "Project" tab, in the "Project" group, click "Description"
- In the "Compilation" tab, check "Indicate shared multilingual messages": this option allows you to quickly identify shared multilingual messages by raising a compilation error.
- Validate the project description window. Confirm the project recompilation.
Remark: For projects with multiple configurations, you will need to run the wizard for each configuration.
Caution: The conversion wizard performs the necessary operations at each step. If the migration is canceled before the wizard completes, only a part of the messages will be converted to the new format (which may cause inconsistencies).
To launch the multilingual message migration wizard:
- On the "Code" tab, in the "Languages" group, expand "Translate strings", and select "Migrate multilingual messages to new format". The wizard starts.
- In the first step, the wizard migrates all calls to MessTranslate (function incompatible with the new format). The calls to this function must be converted to independent multilingual messages. The wizard lists the different calls to this function and automatically converts them when you go to the next step.
- The wizard then checks if the same multilingual message is used multiple times in the project.
In this case, the "Delete links" button allows you to transform linked messages into multiple unique messages. The next step of the wizard converts these messages to the new format.
- The wizard also checks for multilingual messages shared between several projects. The wizard lists the shared files that have at least one multilingual message. The next step consists of converting these messages to the new format, both in the local project and in the project located in the SCM repository.
Caution: only messages from shared elements are converted to the new format. Likewise, it is recommended to convert messages from projects that share resources, to avoid inconsistencies.
- The last step of the wizard process converts all remaining multilingual messages (those that do not cause problems) to the new format.
- When the conversion is completed, you will be prompted to start another wizard to delete unused messages. This will result in a project containing only the messages necessary for the new format.
After running the wizard, all multilingual messages will have a GUID to guarantee their uniqueness, regardless of future changes.
Messages used multiple times
With the previous format, it was possible to "share" a multilingual message (by duplicating code, for example): a message from the message edit window could then be used by two different strings from two different code blocks.
This is no longer possible with the new format. Several problems are thus avoided:
- Modifying a message at a given location, but unknowingly changing it elsewhere,
- Deleting the original message, leaving a blank text elsewhere,
- Using a translation that does not work for every case. One single sentence in English can have different translations depending on the context in another language.
It is still possible to use the same message in different processes: to do so, simply use a variable of type Constant
in the project.
- Declare and set the value of the constant.
In this code, the constant contains the multilingual string to be shared.
ClosingSentence is CONSTANT
ClosingSentence = "You are about to exit the application."
- Use the constant at different parts in the code, where the message is to be used.
- Use Nation to dynamically change the language of the application. The value of the constant will automatically adapt to the language specified with Nation.
Reminder: You can use Nation
to change the language of the entire application (UI, code, values of constants, etc.).
Caution: Using constants to reuse multilingual messages is not always recommended. For example, if you use WDTRAD to translate your applications, you can use the automatic translation feature to propagate translations when identical strings are found. This means that the text has to be translated only once.
This page is also available for…