Sidebar

Combodo

iTop Extensions

Data Localizer

Combodo's customers only

name:
Data localizer
description:
Code free localization utility
version:
1.3.4
release:
2023-07-24
itop-version-min:
2.2
code:
data-localizer
state:
stable
diffusion:
Client Store
php-version-max:
PHP 8.1

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:

 Data localizer edit

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
2023-07-24 1.3.4 * N°6523 - Restore feedback to the user when translations updated
2023-07-13 1.3.3 * N°6523 - Fix translations not updated in iTop 3.1 due to wrong usage of \iApplicationObjectExtension::OnDBUpdate API
2023-07-06 1.3.2 * Add Turkish translations
* N°2199 - Request history tables without the Admin profile
2021-12-27 1.3.1 * Fix compatibility issue with iTop 3.0.0 beta 5
2020-06-17 1.3.0 * Add Russian translation
* Add compatibility with iTop 3.0+
2018-12-11 1.2.0 * Improve jQuery compatibility (jQuery 3 since iTop 2.6)
2017-01-20 1.1.0 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
2014-07-08 1.0.1 Fixed compatibility issues with iTop >= 2.2.0. The compatibility with older versions of iTop has been preserved.
2014-06-11 1.0.0 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.

If a user having a language 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.

Installation

Use the Standard installation process for this extension.

Configuration

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

  'data-localizer' => array (
                'scope' => array (
                  'Service' => 
                  array (
                    0 => 'name',
                    1 => 'description',
                  ),
                  'ServiceSubcategory' => 
                  array (
                    0 => 'name',
                    1 => 'description',
                  ),
                  'RequestTemplate' => 
                  array (
                    0 => 'label',
                    1 => 'description',
                  ),
                  'TemplateField' => 
                  array (
                    0 => 'label',
                  ),
                ),
        ),

Usage

When editing an object for which translation was configured, you get an additional tab in which you can enter translated value for different languages.

 Data localizer edit

It's up to you to enter the appropriate language. When you modify an object with iTop 3.1.0 or above, there are 2 different feedback messages:

  • One related to the object itself, which confirm the modification (green) or inform that nothing was changed (yellow or blue)
  • One related to the translations (the Localization tab) only present if some translations where changed

iTop 2.7.x confirmations

iTop 3.1.x confirmations

For a Portal user, if no translation exists for his own language on a given field, then the default untranslated value is displayed.

Always use the same language for untranslated values, or you will soon get lost

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) Name Description
1 Computers and peripherals Ordering of new hardware (Desktop computer, laptop computer, monitor, mouse, keyboard…) and support in case of hardware failure.
2 Software Management 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.

 Data localizer csv import

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

 Data localize template fields by import

 Data localize template fields by import

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 🚧
  • exporting the values, you will get the user selected value which is not a code but a label, so not consistent

Question: I have develop my own iTop front-end and it is not translated. What should I do?
Answer: A 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').

extensions/data-localizer.txt · Last modified: 2023/07/27 09:52 by 127.0.0.1
Back to top
Contact us