Sisense enables you to translate metadata in your users’ native language. Sisense metadata is displayed in your users’ dashboards and includes the following:

  • ElastiCube fields
  • ElastiCube tables
  • Widget Titles (This functionality is relevant for Sisense V6.6 Beta only.)
  • Dashboard Names (This functionality is relevant for Sisense V6.6 Beta only.)
  • Folder Names (This functionality is relevant for Sisense V6.6 Beta only.)
  • Saved formulas
  • Default and custom hierarchies
  • Customized renamed field titles

The following images display two interfaces with metadata, one in English and the other in Russian.

premeta postmeta
English Russian

As fields such as ElastiCube names and tables are defined by you, these fields are not translated when changing the default language of the Sisense Web Application.

You can translate your metadata by modifying the default values using a JavaScript plugin. Through the plugin, you define the new values to be displayed. You may also include additional logic to determine which users or user groups the translated values should be displayed to.

When you create a JavaScript plugin, you should create a folder for the plugin and place it inside the plugins folder in the following location:

...\Program Files\Sisense\PrismWeb\plugins\

If the \plugins\ folder does not exist, create it and then create a new folder within the \plugins\ folder with the relevant files.

You can download an example of a Metadata Translation plugin here.

Extract the enclosed folder into the plugins folder, …\Program Files\Sisense\PrismWeb\plugins\.

This file contains a folder called Metadata and two files:

plugin.json: The plugin.json file contains the name of the plugin and a link to the file that describes the plugin’s functionality, in this example, run.js.

run.js: The run.js file contains the plugin’s functionality and describes which metadata is to be translated and how it is to be translated.

This example, and any metadata translation JavaScript file you write should include three parts:

      1. Provider Function: These functions provide the mapping context contained in the Mapping object.
      2. Event Subscription: This event is triggered when a datasource changes, and calls the Provider function.
      3. Mapping Object: Contains key/value pairs with your default and translated metadata.

Provider Functions

This functionality is relevant for Sisense V6.6 Beta only and is subject to change.

The code sample below is an example of two Provider functions, the first is a global provider function for folder and dashboard aliasing. The second is the datasource provider function for translating ElastiCube and formula names. You can replace the parameters in this example to provide the mapping context you define in the Mapping object.

Global Provider

function (resolve, reject) {
   //an ajax request or any other logic.
   setTimeout(function () {
   resolve(globalAliasing);
   }, 0);
 };

The following table describe the Provider function and its arguments:

ParameterDescription
resolveA callback function which should be called with the provided aliasing context object or without any parameter if aliases shouldn't be provided for the datasource.
rejectA callback function to be called in case of error, so the system can properly handle it.

Datasource Provider

function (datasourceId, resolve, reject) {
     //an ajax request or any other logic.
     setTimeout(function () {
         resolve(datasourceAliasing);
      }, 0);
 };

The following table describe the Provider function and its arguments:

ParameterDescription
datasourceIdAn object that represents the ID of the datasource with the following properties:

  1. address
  2. database
  3. fullname
  4. ID
  5. title
resolveA callback function which should be called with the provided aliasing context object or without any parameter if aliases shouldn't be provided for the datasource.
rejectA callback function to be called in case of error, so the system can properly handle it.

Event Subscription

To trigger the Provider functions, your plugin should include a handler for a global event ‘beforealiascontextinit’.

In the example below, datasourceProviderFunction and globalAliasingProvider are the Provider functions. The timeout parameter is optional and configures the amount of time in milliseconds which the system waits for the aliasing context to be resolved by the provider function. By default the system uses a timeout of 2000 ms

prism.on("beforealiascontextinit", function (ev, args) {
var timeout = 2000;
args.register(datasourceProviderFunction, globalAliasingProvider, timeout);
});

Mapping Object

The translation context is a simple JavaScript object which contains key value pairs for tables, columns, hierarchies, formulas and custom item titles, all case-insensitive.

The sample below is a skeleton of a Mapping object that defines what metadata is to be translated and its new value.

/**

* tables - aliases for table names
* "tables": {
* "table_name_1": "alias_1",
* "table_name_2": "alias_2",
* }
* columns - aliases for column names in scope of table
* "columns": {
* "table_name_1": {
* "column_name_1": "alias_for_column_name_1"
* "column_name_2": "alias_for_column_name_2"
* "column_name_3": "alias_for_column_name_3"
* },
* "table_name_2": {
* "column_name_1": "alias_for_column_name_1"
* "column_name_2": "alias_for_column_name_2"
* "column_name_3": "alias_for_column_name_3"
* }
* }
* titles - aliases for custom dimension titles, etc
* "titles": {
* "Custom title": "Alias",
* "Sample Revenue": "Sample Profit"
* },
* formulas - aliases for custom formula titles
* "formulas": {
* "Custom title": "Alias"
* },
* hierarchies - aliases for hierarchy titles
* "hierarchies": {
* "Custom title": "Alias"
* }
*/
var datasourceAliasing = {
"tables": {
"brand": "бренд",
"category": "категория",
"country": "страна",
"commerce": "коммерция"
},
"formulas": {
"Revenue": "Чистый доход"
},
"hierarchies": {
"Category by Brand and Age Range": "Категория через Бренд и Год"
},
"titles": {
"CUSTOM REVENUE": "ДОХОДЫ"
},
"columns": {
"Brand": {
"Brand": "Бренд",
"Brand ID": "Бренд Id"
},
"Category": {
"Category": "Категория",
"Category ID": "Id Категории"
},
"Commerce": {
"Age Range": "Возрастные диапазоны",
"Brand ID": "Id Бренда",
"Category ID": "Id Категории",
"Condition": "Состояние",
"Cost": "Затраты",
"Country ID": "Id Страны",
"Date": "Дата",
"Gender": "Пол",
"Quantity": "Количество",
"Revenue": "Доходы",
"Visit ID": "Id Посетителя"
},
"Country": {
"Country ID": "Id Страны",
"Country": "Страна"
}
}
};
/**
* Global object example
* folder - aliases for folder names
* "folder": {
* "folder_name_1": "alias_1",
* "folder_name_2": "alias_2",
* }
* dashboards- aliases for dashboard names
* "dashboards- ": {
* "dashboard_name_1": "alias_1",
* "dashboard_name_2": "alias_2",
* }*
*/
var globalAliasing = {
"folders": {
"New Folder": "Folder renamed",
"my folder": "my folder renamed",
"Any name": "любое название"
},
"dashboards": {
"Sample - Ecommerce (1)": "Коммерческий Dashboard",
"Sample - Healthcare": "Sample Healthcare renamed",
"Sample - Healthcare (1)": "Healthcare renamed",
"my dashboard": "my dashboard renamed"
},
};