How to Handle Multi-Language Translations in QlikView
November 12, 2016 | Author: LinhNguyen | Category: N/A
Short Description
How to Handle Multi-Language Translations in QlikView...
Description
HOW TO HANDLE MULTILANGUAGE TRANSLATIONS IN QLIKVIEW QlikView Technical Brief
July 2012 QlikView 11
Contents CONTENTS ......................................................................................................................... 2 INTRODUCTION ................................................................................................................. 3 SCENARIO 1 – MULTIPLE LANGUAGES STORED IN DATABASE............................... 4 SET THE SCENE ................................................................................................................ 4 Functions, Features and Tricks Used ................................................................... 4
DATA MODEL ..................................................................................................................... 5 Tables ................................................................................................................... 5
SCRIPT................................................................................................................................ 6 STEPS TO TRANSLATE DATA STORED IN MULTIPLE LANGUAGES ......................... 7 SCENARIO 2 – SINGLE LANGUAGE STORED IN DATABASE .................................... 11 SET THE SCENE .............................................................................................................. 11 Functions, Features and Tricks Used ..................................................................11
DATA MODEL ................................................................................................................... 12 Tables ..................................................................................................................12
SCRIPT.............................................................................................................................. 13 STEPS TO TRANSLATE DATA STORED IN MULTIPLE LANGUAGES ....................... 18 ADDITIONAL THINGS TO CONSIDER ............................................................................ 23 SUMMARY ........................................................................................................................ 23 REFERENCES .................................................................................................................. 24
How to Handle Multi Language Translations in QlikView | 2
Introduction
SUPPORTING MATERIALS
The purpose of this document is to provide the knowledge of how to handle multi-language translations in QlikView documents (.qvw). There are several ways to handle multi-language translations, most of the time it depends on how the data is set up, and what the outcome should be. Below is a list of different database scenarios. Database: 1. Database contains data in only one language 2. Database contains data in multiple languages
• QVW. Two QVWs were created illustrating how to handle multi-language translations within QlikView. using the steps outlined in this document. https://eu1.salesforce.com/sf c/#version?selectedDocume ntId=06920000000HPAN
How to Handle Multi Language Translations in QlikView | 3
Scenario 1 – Multiple Languages Stored in Database Set the Scene Company ABC wants to be able to incorporate multi-language translations into their existing applications. In this scenario, the records are stored in the database in multiple languages:
Without the proper filtering, you can see all of the instances for Company in the list box instead of just the instances that correspond to the selected language.
FUNCTIONS, FEATURES AND TRICKS USED To show the correct data within the list box in QlikView, the following QlikView functions, features and/or tricks were used: Set Analysis Only function Aggr function How to Handle Multi Language Translations in QlikView | 4
Data Model Before beginning, let’s take a look at the data models and how we loaded the data. Below is an illustration of the data models created for each data layout. The QVW (https://eu1.salesforce.com/sfc/#version?selectedDocumentId=06920000000HPAN) can also be opened to view the data model.
DATA RECORDED IN MULTIPLE LANGUAGES
TABLES Translations - Contains the translations for all the labels within the application Order – contains the order details with a row for each language
How to Handle Multi Language Translations in QlikView | 5
Script For the most part the script used to create the data model is straight-forward. Illustrated below is how the data was added to the data model.
1. Load the Order table Order: LOAD [Order #], Date(Date), Language, Company, Industry, Sector, Type, Quantity, Price FROM [MultiLanguage Data.xlsx] (ooxml, embedded labels, table is [Order Details]);
2. Load the Translations table Translations: LOAD Index, English, French, German, Japanese, Spanish FROM [MultiLanguage Data.xlsx] (ooxml, embedded labels, table is [Label Translations]);
Now the data model is created, the data translations can begin.
How to Handle Multi Language Translations in QlikView | 6
Steps to Translate Data Stored in Multiple Languages Now that the data model is complete, we can now work on translating the labels and the showing only the data that pertains to the selected language. As part of the expression used to handle the translations, a variable was created to identify the language selected. 1. vDataLanguage: =Language This stores the Language selected
Now let’s begin to translate the object captions: 1. In the object go to the General Tab 2. In the Title enter the following expression: =Only({} [$(=vDataLanguage)])
How to Handle Multi Language Translations in QlikView | 7
3. The Index refers to the Index that is defined in the Excel Spreadsheet
4. The vDataLanguage tells QlikView which column to look at for the translation 5. For this example we’ll assume that the selected Language is English and our Title Index is 1. The intersection looks like this:
The result looks like this:
How to Handle Multi Language Translations in QlikView | 8
6. Next, in the list boxes, we need to need to show only the data for the language selected : Before editing expression
After editing expression
7. In the General tab of the list box, select from the Field area
How to Handle Multi Language Translations in QlikView | 9
8. Next enter the following expression: =Aggr(Only({1} Company ), Company)
9. What the set analysis expression is telling QlikView is, based on the language that is selected, only display a Company if its Language is equal to the Language selected.
Additionally you are going to have to perform this task for all list boxes and Titles that you would like to translate.
How to Handle Multi Language Translations in QlikView | 10
Scenario 2 – Single Language Stored in Database Set the Scene Company ABC wants to be able to incorporate multi-language translations into their existing applications. In this scenario, the records are stored in the database in a single language:
FUNCTIONS, FEATURES AND TRICKS USED To show the correct data within the list box in QlikView, the following QlikView functions, features and/or tricks were used: Applymap
How to Handle Multi Language Translations in QlikView | 11
Data Model Before beginning, let’s take a look at the data models and how we loaded the data. Below is an illustration of the data models created for each data layout. The QVW (https://eu1.salesforce.com/sfc/#version?selectedDocumentId=06920000000HPAN) can also be opened to view the data model.
DATA RECORDED IN A SINGLE LANGUAGE
TABLES Languages – A file with all the languages translated in the application Translations - Contains the translations for all the labels within the application Order – contains the order details
How to Handle Multi Language Translations in QlikView | 12
Script For the most part the script used to create the data model is straight-forward. Illustrated below is how the data was added to the data model.
3. Load the Languages table Languages: LOAD * INLINE [ Language English French German Japanese Spanish ];
4. Load the Mapping Tables – These tables will be used to translate fields into different languages. ////////////////////////////////////////////////////////////// // Company Map // ////////////////////////////////////////////////////////////// [French Company Map]: Mapping LOAD English_Company, French_Company FROM [MultiLanguage Data.xlsx] (ooxml, embedded labels, table is [Company Map]); [German Company Map]: Mapping LOAD English_Company, German_Company FROM [MultiLanguage Data.xlsx] (ooxml, embedded labels, table is [Company Map]); [Japanese Company Map]: Mapping LOAD English_Company, Japanese_Company FROM [MultiLanguage Data.xlsx] (ooxml, embedded labels, table is [Company Map]); [Spanish Company Map]: Mapping LOAD English_Company, Spanish_Company FROM [MultiLanguage Data.xlsx] (ooxml, embedded labels, table is [Company Map]);
How to Handle Multi Language Translations in QlikView | 13
//////////////////////////////////////////////////////////// // Product Map // //////////////////////////////////////////////////////////// [French Product Map]: Mapping LOAD English_Product, French_Product FROM [MultiLanguage Data.xlsx] (ooxml, embedded labels, table is [Product Map]); [German Product Map]: Mapping LOAD English_Product, German_Product FROM [MultiLanguage Data.xlsx] (ooxml, embedded labels, table is [Product Map]); [Japanese Product Map]: Mapping LOAD English_Product, Japanese_Product FROM [MultiLanguage Data.xlsx] (ooxml, embedded labels, table is [Product Map]); [Spanish Product Map]: Mapping LOAD English_Product, Spanish_Product FROM [MultiLanguage Data.xlsx] (ooxml, embedded labels, table is [Product Map]);
How to Handle Multi Language Translations in QlikView | 14
//////////////////////////////////////////////////////////// // Industry Map // //////////////////////////////////////////////////////////// [French Industry Map]: Mapping LOAD English_Industry, French_Industry FROM [MultiLanguage Data.xlsx] (ooxml, embedded labels, table is [Industry Map]); [German Industry Map]: Mapping LOAD English_Industry, German_Industry FROM [MultiLanguage Data.xlsx] (ooxml, embedded labels, table is [Industry Map]); [Japanese Industry Map]: Mapping LOAD English_Industry, Japanese_Industry FROM [MultiLanguage Data.xlsx] (ooxml, embedded labels, table is [Industry Map]); [Spanish Industry Map]: Mapping LOAD English_Industry, Spanish_Industry FROM [MultiLanguage Data.xlsx] (ooxml, embedded labels, table is [Industry Map]);
How to Handle Multi Language Translations in QlikView | 15
//////////////////////////////////////////////////////////// // Sector Map // //////////////////////////////////////////////////////////// [French Sector Map]: Mapping LOAD English_Sector, French_Sector FROM [MultiLanguage Data.xlsx] (ooxml, embedded labels, table is [Sector Map]); [German Sector Map]: Mapping LOAD English_Sector, German_Sector FROM [MultiLanguage Data.xlsx] (ooxml, embedded labels, table is [Sector Map]); [Japanese Sector Map]: Mapping LOAD English_Sector, Japanese_Sector FROM [MultiLanguage Data.xlsx] (ooxml, embedded labels, table is [Sector Map]); [Spanish Sector Map]: Mapping LOAD English_Sector, Spanish_Sector FROM [MultiLanguage Data.xlsx] (ooxml, embedded labels, table is [Sector Map]);
How to Handle Multi Language Translations in QlikView | 16
5. Load the Order Table – Using Applymap we can create translated fields for each of the original fields. Applymap works by defining the map file name, the field to be mapped and new field name created. Order: LOAD [Order #], Date(Date) as Date, Company as [Company_English], Applymap('French Company Map',Company) as [Company_French], Applymap('German Company Map',Company) as [Company_German], Applymap('Japanese Company Map',Company) as [Company_Japanese], Applymap('Spanish Company Map',Company) as [Company_Spanish], Industry as [Industry_English], Applymap('French Industry Map',Industry) as [Industry_French], Applymap('German Industry Map',Industry) as [Industry_German], Applymap('Japanese Industry Map',Industry) as [Industry_Japanese], Applymap('Spanish Industry Map',Industry) as [Industry_Spanish], Sector as [Sector_English], Applymap('French Sector Map',Sector) as [Sector_French], Applymap('German Sector Map',Sector) as [Sector_German], Applymap('Japanese Sector Map',Sector) as [Sector_Japanese], Applymap('Spanish Sector Map',Sector) as [Sector_Spanish], Type as [Product_English], Applymap('French Product Map',Type) as [Product_French], Applymap('German Product Map',Type) as [Product_German], Applymap('Japanese Product Map',Type) as [Product_Japanese], Applymap('Spanish Product Map',Type) as [Product_Spanish], Quantity, Price FROM [Single Language Data.xlsx] (ooxml, embedded labels, table is Sheet1);
6. Load the Translation Table Translations: LOAD Index, English, French, German, Japanese, Spanish FROM [MultiLanguage Data.xlsx] (ooxml, embedded labels, table is [Label Translations]);
Now the data model is created, the data translations can begin. How to Handle Multi Language Translations in QlikView | 17
Steps to Translate Data Stored in Multiple Languages Now that the data model is complete, we can now work on translating the labels and the showing only the data that pertains to the selected language. As part of the expression used to handle the translations, variables were created to identify the language selected. . They are: 2. vDataLanguage: =Language This stores the Language selected
vCompany =chr(91)&'Company' &chr(95) & '$(vDataLanguage)' & chr(93) This creates a string for the translated Company. Example: [Company_English]
vIndustry =chr(91)&'Industry' &chr(95) & '$(vDataLanguage)' & chr(93) This creates a string for the translated Industry. Example: [Industry_English]
vSector =chr(91)&'Sector' &chr(95) & '$(vDataLanguage)' & chr(93) This creates a string for the translated company. Example: [Sector_English]
vProduct =chr(91)&'Product' &chr(95) & '$(vDataLanguage)' & chr(93) This creates a string for the translated company. Example: [Product_English]
chr(91) = [ chr(93) = ] chr(95) = _
How to Handle Multi Language Translations in QlikView | 18
Now let’s begin to translate the object captions: 10. In the object go to the General Tab 11. In the Title enter the following expression: =Only({} [$(=vDataLanguage)])
12. The Index refers to the Index that is defined in the Excel Spreadsheet
13. The vDataLanguage tells QlikView which column to look at for the translation 14. For this example we’ll assume that the selected Language is English and our Title Index is 1. The intersection looks like this:
How to Handle Multi Language Translations in QlikView | 19
The result looks like this:
How to Handle Multi Language Translations in QlikView | 20
15. Next, in the list boxes, we need to need to dynamically select which fields to make visible based on the language selected :
16. In the General tab of the list box, select from the Field area
17. Next enter the following expression: =$(vCompany) =$(vProduct) =$(vSector) =$(vIndustry)
How to Handle Multi Language Translations in QlikView | 21
18. What the variable expression is telling QlikView is to concatenate the language selected ‘_’ and the text ‘Company’. In turn, QlikView shows, within the list box, only the data the the field created by the variable.
Japanese
English
French
German
Spanish
Additionally you are going to have to perform this task for all list boxes and Titles that you would like to translate.
How to Handle Multi Language Translations in QlikView | 22
Additional Things to Consider The translation of labels can also be accomplished by using the fieldvalue function. This approach is not recommended for the following reason: the =fieldvalue function looks for a row number to return a value. The downside to that is that when QlikView reads ‘like’ values in a field it appears as a single value so when there are duplicate values in a field, QlikView condenses the file to show only one field and, in return, it now moves each of the remaining fields up by one. So all values referenced in the =fieldvalue field are now incorrect and the incorrect field value is returned.
Summary In this technical brief, the steps to handle multi-language translations in QlikView were outlined with a focus on two ways that data is stored (single language and multiple languages). We focused on both translating object labels as well as translating specific fields within the data.
How to Handle Multi Language Translations in QlikView | 23
References Below are supporting materials that may be helpful: Zip File – How to Handle Multi-Language Translations in QlikView MultiLanguage Translations.qvw Single Language Translations.qvw MultiLanguage Data.xls Single Language Data.xls https://eu1.salesforce.com/sfc/#version?selectedDocumentId=06920000000HPAN
www.qlikview.com
How to Handle Multi Language Translations in QlikView | 24 © 2012 QlikTech International AB. All rights reserved. QlikTech, QlikView, Qlik, Q, Simplifying Analysis for Everyone, Power of Simplicity, New Rules, The Uncontrollable Smile and other QlikTech products and services as well as their respective logos are trademarks or registered trademarks of QlikTech International AB. All other company names, products and services used herein are trademarks or registered trademarks of their respective owners. The information published herein is subject to change without notice. This publication is for informational purposes only, without representation or warranty of any kind, and QlikTech shall not be liable for errors or omissions with respect to this publication. The only warranties for QlikTech products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting any additional warranty.
View more...
Comments