Spread.Views 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. Spread.Views includes built-in resource file for English, Chinese and Japanese language.
- Custon 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
Add a reference to the following files in the scripts folder:
- gc.spread.views.dataView.locale.en-US.10.1.1.min.js
- gc.spread.views.dataView.locale.ja-JP.10.1.1.min.js
- gc.spread.views.dataView.locale.zh-CN.10.1.1.min.js
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.spread.views.dataView.locale.' + value + '.10.1.1.min.js'; getScript(baseUrl, function() { initGrid(sourceData); }); });
- Initialize the code by calling the grid ID from the DIV tag.