Version 1
Version 1

Localization

DataViewsJS supports localization of inline resources to cater the global users. The two ways to change the inline resources are as follows:

  • Import built-in resource file: Imports the built-in resource file in the HTML head. DataViewsJS includes built-in resource file for English, Chinese and Japanese language.
  • Custom via options: Changes the default text with the custom text using the options.localeResource method.

The steps to enable localization of resources for Japanese language are as follows:

Sample Code

  1. Add a reference to one of the following files in the scripts folder:
  • gc.dataviews.locale.en.js
  • gc.dataviews.locale.ja.js
  • gc.dataviews.locale.zh.js
  1. Add a column definition and define the locale mode change function.
$('#grid-locale-mode').change(function() {
  var sel = document.getElementById('grid-locale-mode');
  var value = sel.options[sel.selectedIndex].value;
  var baseUrl = '[Your Script Path]/gc.dataviews.locale.' + value + '.min.js';
  getScript(baseUrl, function() {
    initGrid(sourceData);
  });
});
  1. Initialize the code by calling the grid ID from the DIV tag.

See also