Please enable JavaScript to view this site.

 

Navigation: Developer Guide > Deploy the MPM Template App

Translate the MPM Template App Multilanguage to a Custom Language

Scroll Previous Topic Top Next Topic More

 

Info

This part of the documentation refers only to the MPM 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 MPM Template App makes use of the MasterItems_MPM-file and the MPM_Translation-file. Both files can be edited to aggregate new translations or change the displayed texts:

MPM_Translations.csv

MasterItems_MPM.csv

 

Warning

Control, that the table InputTranslations (line 11-17) can be loaded from it's source. Maybe you will need to adapt the library it is read from.

 

MPM_Translations.csv

 

This file contains the translations to each language. It includes a column with the object name that you would like to translate, columns with the languages and an ID to identify the objects easily. 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 at 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

EN

This column holds the English translation for the text object.

DE

This column holds the German translation for the text object.

 

Example Automation Rate

 

In this example the Measure_Label_MasterItemID_1130 has the name “Automation Rate”. In the MPM_Translations.csv the entry should be like the following:

 

ID

TextObject

EN

DE

197

Measure_Label_MasterItemID_1130

Automation Rate

Automatisierungsrate

 

 

MasterItems_MPM.csv

 

In this file all the master items of the MPM Template App are stored as has been described widely in Define Master Items in the Script. To have the master items automatically adapt to another language two fields in MasterItems_MPM.csv are important:  _MasterItemLabel and _MasterItemExpression.

 

Properly in different languages, the master item expressions and master item labels have adapted. The master item expression controls the number and date format and the label the master item languages showed in the app.

_MasterItemLabel: steers 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 MPM_translation.csv, which is why the _MasterItemLabel now holds an expression as the following:

 

only({<TextObject = {TextObject}>} $(mvSelectedLanguage)) 

 

 

Warning

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: steers the number or date formats (e.g. 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 7 defined variables. These variables are defined in the MPM_translation file for German and English. To aggregate formats for another language, adapt the variables in the translation-file.

omvDateFormat

omvDecimalFormat

omvNumFormat

omvNumFormatPercentage

omvNumFormatWithoutDecimals

omvThousandSepFormat

omvTimestampFormat

 

You have to use them in combination with your measure expression as the following.

 

Num(

Sum(MyMeasure),

,$(mvNumFormatWithoutDecimals),

$(mvDecimalFormat),

$(mvThousandSepFormat)

)

 

Or 

Date(

MyDate,

$(mvDateFormat)

)

 

 

Please read here about the num(), date() and timestamp() functions of Qlik in case of questions.

 

Example Automation Rate

 

The MPM_MasterItems.csv for the previous Automation Rate Example contains the following:

 

_MasterItemID

_MasterItemLabel

_MasterItemName

_MasterItemExpression1

1130

only({<TextObject = {Measure_Label_MasterItemID_1130}>} $(mvSelectedLanguage))

%Automation rate

num(
sum({<RealUser = {0}>} ActivityCounter)/Sum({<RealNode = {1}>} ActivityCounter)
,$(mvNumFormatPercentage),
$(mvDecimalFormat),
$(mvThousandSepFormat)
)

 

 

After this, you import the master items as usual.

 

© by MEHRWERK GmbH