Multi language data in your application

  • 20 November 2020
  • 0 replies
  • 60 views

In applications built with the Thinkwise Platform, the GUI supports multi language translations of objects like menu’s, entities, columns, tasks, and so on. However, the data is not multi language (yet). For example, when you have a table Products, the name of the product can be “Car”. This is fine when you’re English speaking, but when you’re French, it would be nice if you would see ‘Voiture’.

The data to be translated resides in your application, not in the Thinkwise Platform. Therefore it is hard (and not desirable) to solve this challenge in the Thinkwise Platform itself.

Goal

In this solution you will find functionality to translate one or more values per record. This functionality automatically generates:

  1. Tables in which you can translate one or more values of records.
  2. Lookup queries which retrieve lookup values in the language of the user.

Solution

The solution for multi-language data consists of one Dynamic Model script. This script generates translation tables for every table which has columns with a TAG which name is stored in variable @translation_tag_id.

The new tables are constructed as follows: Table name = Table name + value in @translation_post_fix

You must have a language table, defined by yourself. The name of this table must be stored in variable @language_tab_id. The primary key column of this table must be assigned to: @language_pk_col_id. This script assumes this table has one primary key column. If you have more primary key columns in this table, then you have to modify this script.

A user table is needed in which the login and the language is defined. The name of the table must be stored in @user_tab_id. The primary key column of this table must be assigned to: @user_pk_col_id. This script assumes this table has one primary key column. If you have more primary key columns in this table, then you have to modify this script. Finally, this table needs a foreign key to the table in @language_tab_id. The name of the foreign key column must be the same as the one in @language_pk_col_id.

Instructions

  1. Add the script to you dynamic model
  2. Create a table for users
  3. Create a table for languages
  4. Link the languages table to the user table
  5. Create a tag with the name stored in @translation_tag_id
  6. Add tag @translation_tag_id to all columns you wish to be translated.
  7. Enter your names in variables:
    1. @translation_tag_id
    2. @translation_post_fix
    3. @user_tab_id    
    4. @user_pk_col_id
    5. @user_name_col_id
    6. @language_tab_id
    7. @language_pk_col_id 

Example

In this example you’ll see a very small application. It has users, customers, products and materials, and finally order with lines. There is one product named Car. It is translated in French as Voiture. At user level the language is changed from English to French. The result is that in Order Line the value Car is automatically changed to Voiture, while in the database the product stays the same.

 


0 replies

Be the first to reply!

Reply