Handling multiple languages and translations

By Frédérique Verhagen

Handling multiple languages and translations in QlikViewRecently I made a QlikView application with multiple languages. I came across a blog post by Charles Bannon: “Handling multiple languages”. Charles describes two scenarios for the use of multiple languages. The first scenario, “translate labels and textboxes within the application and not the actual data”, solved my problem. Charles uses a translation table with an index. He uses set analysis to reference the index number and the language. The expression used is:

=Only({<Index={5}>} [$(=vDataLanguage)])

A good solution, but not very user-friendly. Do you know which translation belongs to index 5?

In this blog post I will rewrite the expression to a more user-friendly and readable formula, and will also explore some other ways of dealing with translations in QlikView.

Method 1: Translation identifier

First, I added the column Text2Translate on the translation table. This is a “translation ID”.

translationtable

(NOTE: In the example QVW I use an inline table but you can also load an Excel table.)

Second, I created a SelectedLanguage Table:

selectedlanguagetable

I add the variable vLanguage, the language which the user selected:

vLanguage: =SelectedLanguage

Now we can rewrite the expression from Charles:

Only({<Text2Translate={‘tUnitPrice’}>} [$(vLanguage)])

The expression is more readable but still not user-friendly.

We can create a variable vTranslate with a parameter ($1) for the text2translate:

vTranslate: Only({<Text2Translate={$1}>} [$(vLanguage)])

We can use this variable to translate labels in QlikView by passing the text we wish to translate as a parameter:

$(vTranslate(‘tUnitPrice’))

Now we have three expressions with the same result; which expression do you prefer?

translationexpressions

Be careful though!

We’ve created a data island: the SelectedLanguage table. Read the consequences of using data islands in Rob Wunderlich’s blog post “The impact of data islands on cache and cpu”.

Every time a user switches the language in the application, QlikView recalculates EVERY object on the sheet! I assume a user doesn’t regularly change the language in the application, so the data island doesn’t have to cause any performance problems. If the user does switch the language a lot and it causes performance issues, you can try Rob Wunderlich’s suggestions:

 

Method 2: Language variable

Create an input box with a new Language variable with constraints:

languagevariable

 

Method 3: Alternate states

  1. Go to Document properties -> General tab -> Alternate States button
  2. Add an alternate state
  3. Add a list box with the field SelectedLanguage
  4. Go to List box properties -> General tab
  5. Change the alternate state from <Inherited> to your new alternate state
  6. Change the vLanguage variable to =only({Language} [SelectedLanguage])

(Learn more about alternate states here)

 

Example

I have included all three methods described above in an example file, you can download this using the following link:

Download the translation examples

About The Author

Frédérique Verhagen

Hi! I am Frédérique, I graduated in Business Mathematics from the Hague University of Applied Sciences and am working as a Junior Business Intelligence Consultant at Bitmetric since February 2015. Via my blog posts, I will share interesting QlikView/Qlik Sense features and applications that I come across. My main subject areas will be data visualization and applied mathematics.

One comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Read previous post:
A very elegant link table script

Today was the last day of the Masters Summit for Qlik in Johannesburg and we all had a great time....

Close