User Tools

Site Tools


extensions:data-localizer
Translations of this page:

Data Localizer

Combodo's customers only

name:
Data Localizer
version:
1.1.0
release:
2017-01-20
description:
Localize the labels seen by your customers
itop-version:
2.2, 2.3
code:
data-localizer
diffusion:
ITSM Designer

Allow to localize data in the Console, adding translations in multiple languages. Results are only visible in the User Portal.

Declare which data have to be localized, and a new tab appears aimed at managing the localized attributes:

In your custom user portal, add a single line of code to activate the localization depending on the current user, and that's all: there is no need for modifying the data model nor rewriting the code of the user portal.

Features

Support all the localizations supported by iTop.

Integrated into the core of the framework so that it is transparent to the DBObject API and the OQL ! For instance, SELECT Service WHERE name LIKE '%Network%' will not give the same results depending on the language of the current user.

The translation is done directly where the data is usually edited.

It is compatible with the module “Request Templates”.

Revision History

Version Release Date Comments
1.0.2 2017-01-20 Requires iTop 2.2.0. Added an index for high volumes of data. Added a message into the localization form (known limitation) for a better user experience
1.0.1 2014-07-08 Fixed compatibility issues with iTop >= 2.2.0. The compatibility with older versions of iTop has been preserved.
1.0.0 2014-06-11 First version

Limitations

  • Translated values are limited to strings with less than 255 characters
  • Data are localized only in user Portal (it is not possible to localize data in the iTop Console)

It is not possible to localize the data on an object during its creation process, just modify it after to add translations.

This has an impact on the MySQL queries generated by iTop. If the functionality is used on a class of objects for which there are lot of external keys, or if an OQL is written with a significant number of joins, then the limit of 64 tables will be reached.

Defining OQL condition on translated field is at risk. Within Portal scopes it can fails.

Known Issues

If a user having a langage different from the iTop instance, connect to the portal, then using the same browser, connect to the console and modify an object from a class for which Localization is defined, then iTop has a bug and store the object using the user langage instead of the iTop one.

Workaround: when a user switch from Portal to Console, it is a good practice to use a different browser or private navigation for one of them.

Requirements

The user portal (or any GUI that needs to be translated) must be customized to execute the following line of code:

ApplicationContext::SetPluginProperty(‘QueryLocalizerPlugin’, 
                                      ’language_code’, 
                                      UserRights::GetUserLanguage() );

Where UserRights::GetUserLanguage() can be replaced by any other mean to get the language code (e.g: 'EN US').

Installation

Copy the folder data-localizer into the extensions folder of iTop and launch the setup again. When prompted to select the extensions to install, check “Data localizer” in the list of available extensions.

Make sure that the web server has enough rights to read the content of the extensions folder and all its sub-folders before launching the setup

Configuration

There is one configuration parameter, defining which attributes will be localized:

'scope' => array(
   'Service' => array('name', 'description'),
   'ServiceSubcategory' => array('name', 'description'),
   'RequestTemplate' => array('label', 'description'),
   'TemplateField' => array('label'),
),

Bulk load

To load lots of Localized data, you can perform an interactive CSV import example provided for a user in english

Mapping must be done on 4 fields which are:

  • Object class = must be one for which DataLocalizer was enabled in Configuration file
  • Object id = This is the id (primary key) of each object to translate
  • Language code = check in your Data Model, class DataLocalization for allowed values
  • Attribute code = must be an attribute of this class enabled for Localization

Provide also

  • Value = value to set or overwrite
Loading data by this mean requires some expertise and care. If the loaded data is incorrect, the effects are unpredictible.

You can check existing Localization data, using the “Run queries” and the following OQL:

SELECT DataLocalization 
SELECT DataLocalization WHERE obj_class='Service' AND language='DE DE' AND attribute='name'

You can then export the result in CSV or Excel


Import step by step

Lets suppose that you want to localized your Services, which are in english and you want to translate in French the name and the description.

1. In your iTop, do an export of your Services with those fields: id (Primary Key), name and description. Let's assume you have 2 services like this:

id (Primary Key)NameDescription
1Computers and peripherals Ordering of new hardware (Desktop computer, laptop computer, monitor, mouse, keyboard…) and support in case of hardware failure.
2SoftwareManagement of computer software and applications. Installation, upgrade, troubleshooting and removal of software.

2. Prepare a file with 2 rows for each of your services, one row for translating the name and one for the description. Result would look like this:

Object class Object id Language code Attribute code Value
Service 1 FR FR name Ordinateurs & périphériques
Service 1 FR FR description Commander un nouvel équipement (Ordinateur de bureau, ordinateur portable, écran, souris, clavier…) et de l'aide en cas de panne.
Service 2 FR FR name Logiciels
Service 2 FR FR description Gestion des applications: installation, mise à jour, suppression, analyse de panne

3. CSV import that file.

Questions and Answers

Question: Can I localize Request Template Fields?
Answer: Yes, you can localize label but probably not the initial_value and the possible values.

Configuration file
	'data-localizer' => array (
		'scope' => array (
		  'TemplateField' => array ('label','values'),
		),
	),
Object class 	Object id 	Language code 	Attribute code 	Value
TemplateField 	16 	EN US 	values 	blue,green,yellow,red,orange,purple,black,white
TemplateField 	16 	FR FR 	values 	bleu,vert,jaune,rouge,orange,violet,noir,blanc
TemplateField 	16 	EN US 	label 	Requested color
TemplateField 	16 	FR FR 	label 	Couleur imposée

If you localize values be cautious:
  • if the User Request is created with a localized value, the agent in the console won't see that value? He will probably loose it, unless service_details is read_only. To be checked FIXME
  • exporting the values, you will get the user selected value which is not a code but a label, so not consistent
extensions/data-localizer.txt · Last modified: 2021/12/02 10:32 (external edit)

";