Polybench® for biosignals / reference 1.34.1
Translation tables for multilingual applications.

Language Repository

Overview

Texts that are displayed to the end-user in your Polybench application can be displayed in other languages. The Language Repository is a system that allows to change the display language on the fly.

Details

Background

The idea behind the Language Repository is that the language in which an application is desiged, also functions as 'key' for translated texts. So, in Polybench Designer, for selected components, text is entered by the programmer using the Properties dialog, but the components show the text in the user interface in the currently selected language.
If no language is selected, or no translation can be found, then the text originally written in the designer is used.

Location of the language translation files

Language files are optional. They are located in the directory Languages, which is located in the same folder as your application .XMC file is located.

Inside the Languages folder, there are folders for all available languages. Inside those folders, there should be translation files that have the same file name as your .XMC file, but then using the extension .XMCL.
The folder name where the translation file is located, is not so important. It could be the Englisch name of the language. Inside the translation file, the language name in its own language (as may be displayed to the end-user) is specified.

Contents of the translation .XMCL file

A translation file contains translation blocks, called phrases. Each phrase consists of a key, and a translation.
The key is is the original text that is used in Polybench designer (what you have typed into the properties dialog), and that is written inside the .XMC file.
The translation is that text written in the language that is specified for the .XMCL file.

The key may contain one or more variables, because in a number of components texts with variables are allowed. The variables in the translation table are reduced to only the dollar-signs ('$$'). Of course, any variable in the key should also be part of the translation. The order of variables cannot be changed in the translation (Polybench expects the same order as used in the key).

Key and translation may span multiple lines.

The next image shows an example of a translation .XMCL file:



How to show available languages to the user

The available languages are loaded immediately after loading the source project (.XMC). Available languages are listed as part of the variable parameters of the Project ("Project") and can be read from $_APP.Languages$.
Specify $_APP.Languages as address in a Drop Down List ("Drop Down List"), while setting the Action to LANGUAGE ("LANGUAGE"). This changes the user interface language immediately when another language is selected in the list.

Tools to create and modify language translation files

For more information see "Text translation tool".

Caution: changing original texts in an app

If translations exist, then care must be taken to change the original texts in an app, because those texts serve as translation keys in all translation files. If the original text must be changed, then all corresponding keys in the the translation files must also be changed.

Hint: If, for example, the original text is written in English, but the text contains a typo. Correcting that typo could mean that all translation files have to be changed as well. In stead, one could add an English translation file, where the keys and translations are equal most of the time, except for any corrections in the translation.