Add a Custom Language to the mpmX Template App Multilanguage
mpmX natively supports a large number of languages, enabling the cross-regional use of mpmX apps. In addition to German and English, mpmX also supports French, Spanish, Italian, Chinese (simplified) and Turkish, among others. Other languages can be developed and provided individually on request.
The supported languages affect the environment as well as the mpmX apps and the developed dashboards.
This part of the documentation refers only to the mpmX Template App April 2020 Multilanguage.
The multilanguage function includes all text translations, proper dates and number formats according to the language selected. The language can be selected via button in the front end.
How does it work?
The multilanguage function in the mpmX Template App makes use of the MasterItems_mpmX file and the mpmX_Translation file. Both files can be edited to aggregate new translations or change the displayed texts.
-
mpmX_Translations.csv
-
MasterItems_mpmX.csv
Check that the table InputTranslations can be loaded from its source, or else you will need to adapt the library it is read from.
mpmX_Translations.csv
This file contains the translations to each language. It includes a column with the object name that you would like to translate and its ID to identify the objects easily, as well as columns with the languages and their Description. At the moment, only English and German is available, therefore you have columns for DE and EN. You can add more languages, that will be available in the apps front end, by creating new columns with the translation to the respective language.
The columns in the actual template are:
Field Name | Explanation |
---|---|
ID | A unique identifier for the text object |
TextObject | A speaking identifier, that will be used in the front ends label within the only-expression. The naming convention for Master Items is the following: <Measure|Dimension>_Label_MasterItemID_<MasterItemID>. For chart titles the naming convention is: <Sheetname>_<ChartType>_<Title|Text|Subtitle|Footnote>_Number A text object can be: - Instructions in a Text Box - Chart titles (all kind of charts) - Chart subtitles - Chart footnotes - Displayed message in a chart with calculation condition - Sheet names - Labels of Measure and Dimensions (master items) - Variables for number and date formatting |
DE | This column holds the German translation for the object. |
EN | This column holds the English translation for the object. |
ES | This column holds the Spanish translation for the object. |
DE_Description | This column holds the German translation for the description of the object. |
EN_Description | This column holds the English translation for the description of the object. |
ES_Description | This column holds the Spanish translation for the description of the object. |
mpmX_Translations.csv - Example Automation Rate
In this example the Measure_Label_MasterItemID_1130 has the name “Automation Rate”. In the mpmX_Translations.csv the entry should be like the following:
ID | TextObject | EN | DE | ES | EN_Description | DE_Description | ES_Description |
---|---|---|---|---|---|---|---|
197 | Measure_Label_MasterItemID_1130 | Automation Rate | Automatisierungsrate | tasa de automatización | The Automation Rate is calculated based on the field RealUser. | Automatisierungsrate ist berechnet auf Basis des Feldes RealUser. | La tasa de automatización está calculada basado en el campo RealUser. |
MasterItems_mpmX.csv
In this file all the master items of the mpmX Template App are stored as has been described widely in Reuse Existing Master Dimensions.
Two fields in MasterItems_mpmX.csv are important to have the master items automatically adapt to another language: _MasterItemLabel and _MasterItemExpression.
The master item expressions and master item labels have properly adapted in different languages. The master item expression controls the number and date format and the label that the master item languages show in the app.
-
_MasterItemLabel: Controls the translation of any text displayed in the front end. Therefore it holds a formula instead of a clear name. This formula makes use of the mpmX_translation.csv, which is why the MasterItemLabel now holds an expression as the following:
only({<TextObject = {TextObject}>} $(mvSelectedLanguage))
The {TextObject}
has to be replaced with the exact name that was given to MasterItem in the column TextObject of the translations file. Refer to the example below.
-
_MasterItemExpression: Controls the number or date formats (such as adapting from comma to point notation when switching from German to English). Every measure expression has to be num- or date-formatted by using formats that are held in seven defined variables. These variables are defined in the mpmX_translation file for German and English. To aggregate formats for another language, adapt the variables in the translation file.
-
mvDateFormat
-
mvDecimalFormat
-
mvNumFormat
-
mvNumFormatPercentage
-
mvNumFormatWithoutDecimals
-
mvThousandSepFormat
-
mvTimestampFormat
-
You have to use them in combination with your measure expression as shown here.
Num(
Sum(MyMeasure),
,$(mvNumFormatWithoutDecimals),
$(mvDecimalFormat),
$(mvThousandSepFormat)
)
Please read here about the num(), date() and timestamp() functions of Qlik in case of questions.
MasterItems - Automation Rate Example
The mpmX_MasterItems.csv for the previous Automation Rate Example contains the following:
_MasterItemID | _MasterItemLabel | _MasterItemName | _MasterItemExpression1 | _MasterItemDescription | ScenarioFlag | SourceSystem | _MasterItemFormatType |
---|---|---|---|---|---|---|---|
1130 | only({<TextObject = {Measure_Label_MasterItemID_1130}\>} $(mvSelectedLanguage)) | %Automation rate | num (sum({<RealUser = {0}>} RealNode)/Sum(RealNode) ,$(mvNumFormatPercentage),$(mvDecimalFormat),$(mvThousandSepFormat)) | Measure_Label_MasterItemID_1130 | mpmX | Custom | Measure Expression |
After this, you import the master items as usual.