Tools ModelTranslationEditor/en: Unterschied zwischen den Versionen
Cg (Diskussion | Beiträge) |
Cg (Diskussion | Beiträge) |
||
Zeile 31: | Zeile 31: | ||
# open the "Model Language Editor", |
# open the "Model Language Editor", |
||
# Fetch all existing tree-element names via the "''Utilities''" & |
# Fetch all existing tree-element names via the "''Utilities''" → "''Fetch Names from Tree''" menu item |
||
# specify the language to be |
# specify the original language to be english (via "''Utilities''" → "''Set Original Language''" menu item |
||
# specify the target language to be added (i.e. select "de_de") |
|||
# add the translation, by selecting an untranslated name and editing its "translated" value |
# add the translation, by selecting an untranslated name and editing its "translated" value |
||
# change the language to "fr_fr" and repeat the previous step |
# change the target language to "fr_fr" and repeat the previous step |
||
# confirm by saving via the "''Save''" menu item. |
# confirm by saving via the "''Save''" menu item. |
||
Version vom 2. Juni 2025, 07:48 Uhr
Expecco uses two separate national language translation schemes:
- language translations for the GUI (i.e. menus, button labels, window titles etc.=
- language translations for model elements (blocks, steps, pins, etc.) and especially text presented to the user by Dialog actions or user defined UIs.
Both languages can be changed independently in the settings dialog ("Extras" → "Settings" → "Language").
However, the translation information is stored in separate places.
- The translation strings for the GUI are bundled with the original distribution provided by eXept, and more or less fix (although, a knowledgeable user can easily add new languages and/or modify existing language translations, as these files are plain regular text files in the "
resources
" subfolders).
- The model language translations are stored in the project-file itself, and are attached to the top-level "Project" tree item. These are stored in and transported with the testSuite-file.
Defining national translations for model elements is very useful in multi-language companies. Especially, when considering the documentation aspect of the graphical programming model: every programmer can see the action, step and pin names in his/her native language.
Even more important are texts and labels shown in GUI dialogs (confirmations, warn boxes or reports) both in the common dialogs from the Standard Library, and texts in custom dialogs (i.e. in actions with GUI or manual test steps). Those are also translated via the "Model Language Translation" mechanism.
Model language translations are added, modified and possibly removed using the "Model Translation Editor", which is opened via the "Extras" → "Translations" menu item.
For development in a multi-language environment, it is a good strategy to choose one language as the primary language, and base all translations on that. Usually this would be English. However, this is not a strict requirement: any language can be added later at any time and in any order. Thus, it is also possible to start in German, and add French, Italian and English translations later.
Action, Step and Pin Names[Bearbeiten]
For the following example, we assume, that the tree elements are initially named in English,
and translations are to be added in German and French.
Perform the following steps:
- open the "Model Language Editor",
- Fetch all existing tree-element names via the "Utilities" → "Fetch Names from Tree" menu item
- specify the original language to be english (via "Utilities" → "Set Original Language" menu item
- specify the target language to be added (i.e. select "de_de")
- add the translation, by selecting an untranslated name and editing its "translated" value
- change the target language to "fr_fr" and repeat the previous step
- confirm by saving via the "Save" menu item.
To see the effect, in your tree/diagrams, change the model language in the settings dialog.
Notice, that the GUI's language remains the same; English, in this example.
Hint: as the length of word differs by some 20-30% among languages, some steps may now be too small to show the possibly longer names.
Therefore, it is a good idea, to reserve some additional space for every new step by making them somewhat wider right from the start.
Dialog Messages / Report Strings[Bearbeiten]
For a step's input string to be translated, select the pin and open its pin menu via the right button. Find the submenu under "Attributes" and turn on the checkbox for "Model Language Translated". Then, any incoming string will be translated via the mechanism (or left untranslated if no translation was defined for it).
Slicing Words into a Translation[Bearbeiten]
Be aware, that different languages will use different sentence building rules; so subject or object are often in different position within a sentence. For example, the english
"Do you really want to delete the file XXX?"
would be in German:
"Wollen Sie die Datei XXX wirklich löschen?"
That means that a simple string concatenation is usually not giving you good translations. In the previous example, the German translation "Wollen Sie die Datei wirklich löschen XXX" sounds horrible to every german.
To fix this, use %-placeholders and format the resulting string. Instead of the above, define a translation like:
"Do you really want to delete the file %1?" -> "Wollen Sie die Datei %1 wirklich löschen?"
and then provide the actual filename either in elementary code:
resources string:'Do you really want to delete the file %1?' with:fileName
or
i'Do you really want to delete the file {fileName}?'
Or in a compound action, use the "String [format]" action and pass the string (with placeholders) to its first input, and the args to be sliced in to the [1]..[n] inputs. Don't forget to turn on the pin's "Model Translate" attribute.
Back to Online Documentation.