To translate the GUI one needs to alter the translation files of the BladeDesigner. Translation files are not equal to language packs. Thanks to Qt and the chosen program structure these files are almost independent from development itself.
Already existing translation files are stored in the BladeDesigner-directory ./src/GUI They share the extension .ts and are called GUI_.ts*. The tag in * determines the language the translation file contains (de = german, en = english and so on ...).
To add a translation or change an existing one, load the translation file of the language into QT Linguist via File -> Open.... Qt Linguist can load more than one file at a time, to translate a text into several languages simultaneously. Hold down Strg-Key to select more than one file.
How to use Qt Linguist as a translator is described here: Qt Linguist for Translators.
After editing the translation files the new changes must be added to the GUI sources. In the direction ./src/GUI there is a CreateGUI.sh script, which needs to be run:
It creates the language pack files and puts it in the language pack directory ./src/GUI/Sprachpakete. Also it recreates the resource file, which contains the languages. After launching the BladeDesigner the translations can directly be checked in action.
Adding a new language pack is very easy. Therefore only a new translation file must be created from the existing strings. After turning into a language pack it can be loaded dynamically, when stored in the directory ./src/GUI/Sprachpakete. The creation script will put it there automatically. However the new language packs can then be shipped individually or with the whole distribution. The following steps have to be taken to create a new language pack:
Which translation files to update and to create is stored in the GUI.pro in the ./src/GUI directory of BladeDesigner. In fact this is a project file of the BladeDesignerGUI-Qt project. Important for translation purpose is the last row of this file:
TRANSLATIONS = GUI_de.ts GUI_en.ts
To add a new translation file, add a GUI_.ts*, where * is a valid ISO 639 language code . For example for a Japanese language pack:
TRANSLATIONS = GUI_de.ts GUI_en.ts GUI_jpn.ts
Afterwards the translation file needs to be created with a call to:
$ pylupdate4 GUI.pro
This updates all translation files and creates missing ones. Now a corresponding translation file should be created.
After creating a new translation file, it can be translated and converted like described in section Translating GUI.
The new created translation file must be written to the base resource file of BladeDesigner, so it can be compiled into the resource file and used on launch. Therefore the following line needs to be added to the resource base file ./src/GUI/UI/BladeDesignerGui.qrc at the bottom of the existing translation file declarations:
The * is to be replaced by the ISO 639 language code of the created translation file.
What’s this? messages are displayed when first clicked on the little question mark in the upper right corner and then on a widget of BladeDesigner. It displays a specific help text or gives a link explaining the use and intention of the widget.
“What’s this?” messages can be edited using Qt Linguist. Therefore open an existing translation file like described in section Editing available translation files. In some categories, mostly the UI ones not starting with Q, there are tags starting with WhatsThis, which indicate that the content of this string is the displayed “What’s this?” message. The translation of the so tagged statements are the shown “What’s this?” message.
There can also be added links instead of pure text. Therefore BladeDesigner offers its own help window and a special statement in the translation to indicate the link. To add a link use the following statement:
link <type> <url>
The type parameter is important for the help window to determine the source of the link. Type may be one of the following parameter:
|d||the link leads to the doxygen, the base source is ./doc/Doxygen/html/|
|h||the link leads to the handbook, the base source is ./doc/Handbook/html/|
|o||the link leads to an other source like the Internet or a file, there is no base source|
Here are some examples:
A link to the BladeRow section in the handbook. Links to: ./doc/Handbook/html/BladeDesignerch2.html#x4-140002.3
link h BladeDesignerch2.html#x4-140002.3
A link to google
link o http://www.google.de
A link to QBladeDesigner class. Links to: ./doc/Doxygen/html/class_q_blade_designer_1_1_q_blade_designer.html
link d class_q_blade_designer_1_1_q_blade_designer.html
There are some examples in BladeDesigner and its corresponding transaltion files to see the effect of the different statements and how to implement them directly. For a certain example try out the following entries in BladeDesigner using the WhatsThis-Button or by looking it up in the translation files:
It may be the case, that there is a widget in BladeDesigner, which does not have a preset tag. There tag in fact is set by the GUI programmer in Qt Designer. In this case, the tag can easily be set. Therefore open corresponding widget in Qt Designer, click the widget without “What’s this?” message and type in the tag at “whatsThis” property:
Afterwards the translation file needs to be updated to insert the new tag. This is done with a call to:
$ pylupdate4 GUI.pro
The new tag is now available and can be changed via Qt Linguist as explained in Editing “What’s this” messages