how do you go about implementing SenseTalk
scripts with multilingual support?
We have several applications in two or more different languages for testing.
Currently we have implemented this the following way:
1. Two global parameters are used, one for the system language (global sysLanguage), one for the application language (global appLanguage)
2. Determination of the system language for
' global sysLanguage ' as abbreviation "de-DE", "en-US" via
Reading the first message after opening the CMD window readText(searchrectangle_UpLeft) => "Alle Rechte vorbehalten" vs. "All rights reserved" or via registry value.
3. Determination of the application
language for "global appLanguage" as abbreviations "de-DE",
Application-specific image is recognized as "language identifier":
For example, the image for the German application language is stored in the collection with image name "de-DE", for the English application with name "en-US".
During image recognition, the language identifier is extracted from the image name and the application language is set.
In the context of language recognition, there is only one image per language, which makes the use of subfolder unnecessary.
If you want to work with subfolders, the language abbreviation must be extracted from the path name of the file.
4. A translation file, a multi-column CSV
file in UTF-8 format, is maintained for each system and application language.
The first column contains any keyword that is unique in the column, the other language columns contain the corresponding terms, words, alpha-numeric entries per language.
The language columns also have the corresponding headings "de-DE", "en-US".
The language-dependent words are returned by the function getString (keyword, true/false).
E.g.: The system language with
"en-US" was detected.
getString("Datei", true) searches the entry "Datei" in the system language file and selects the value "File" from the column "en-US".
Practical example: Internet Explorer, open menu "Internet options" -> browser has English language setting, so the menu entry is "Internet options”.
The language independent command typetext altKey, "x" opens the settings menu.
typetext "t" opens the Internet options window in German, typetext "o" opens the Internet options window in English
getString("IEopt", false) searches for the entry "IEopt" in the application language file and selects the value "o" from the column "en-US"
5. This results in the line of code:
'typetext getString("IEopt", false)'.
Language dependent images are stored in subfolders of the relevant collections.
The subfolders have the names of the above-mentioned language abbreviations, such as CollectionName/en-US/image_en1.
A function returns the images of the collection with getImage("CollectionName", true), the parameter "true" ensures that only the images from the language-dependent subfolder "en-US" are used for comparison.
E.g. waitfor 5, image: getString ("CollectionName", true"), searchRectangle: "rectangle name"
For an extension to e.g. the Italian language only an image in the new subfolder "it-IT" would have to be created and the entry in the language file would have to be extended by one column, the code remains unchanged!
How did you map the multilingual support in the scripts, or do you separate your scripts per language?
If you want to share further information, please leave a comment or send a short DM.