TestMultiLanguage

MacroModule
author MeVis Medical Solutions AG
package MeVisLab/Standard
definition scripting.def
keywords MDL, example, translation

Purpose

The module TestMultiLanguage shows how to use multi-language support.

Details

The following lines must be added at the <modulename>.script file:

hasTranslation = yes

translationModules = ""

translationLanguages = de,jp

The translationLanguages contains the used translated languages (additional to default/english). (A .ts file will be created for the used languages).

After saving the script file, the following “Create/Update Translation Files” context menu entry is available:

../../../Modules/Macros/Tests/Scripting/mhelp/Images/Screenshots/createupdate.png

The .ts files will be created by clicking on the “Create/Update Translation Files” context menu entry.

(In this example two ts files will be created: TestMultiLanguage_de.ts and TestMultiLanguage_jp.ts)

At the .ts files, the translated words must be entered. You can use any text editor or the QtLinguist tool (recommended).

When using QtLinguist, the adapted files must be released. (Menu > File > Release). Now the .qm files are created.

An other way to create the .qm files is to use the Qt function ‘lrelease.exe’ in *.bat files (See example CreateQmFileExsample.bat)

To switch the language, the MLab variable “Locale” must be set to using the desired language.

See example function call for ‘German’ language: MLAB.setVariable("Locale", "de_DE")

Windows

Default Panel

../../../Modules/Macros/Tests/Scripting/mhelp/Images/Screenshots/TestMultiLanguage._default.png

Parameter Fields

Visible Fields

Test

name: test, type: String, default: somestring6

My Title

name: myTrigger, type: Trigger

Enum Field

name: enumField, type: Enum, default: english

Values:

Title Name
Englisch english
Deutsch german

Hidden Fields

messageText

name: messageText, type: String