Our pivot table can easily be translated into different languages. This article describes the process of language localization for WebDataRocks reporting component.

Available localizations:

Localization files for new languages can be added by creating a new pull request on GitHub. Our team highly appreciates any help.

To translate your pivot table into a different language you need to accomplish these steps:

  1. Download template JSON file. It contains all labels that are used in WebDataRocks and English values for them.
  2. Translate values into the language you want. For example, you want Spanish localization. You start from replacing the first label-value pair from the template ("flatHierarchyBox": "Select and arrange columns") with its Spanish equivalent ("flatHierarchyBox": "Seleccionar y organizar columnas") and keep on the same way with the whole file (e.g., check Spanish translated sample).
  3. Use your translated file to change the language in pivot component. It can be done in any of the following ways:

    a) If you want to set one language for all reports, add global object when initializing WebDataRocks:

    <script>
    var pivot = new WebDataRocks({
    	container: "#wdr-component",
    	toolbar: true,
    	report: {
    		dataSource: {
    			filename: "https://cdn.webdatarocks.com/data/data.csv"
    		}
    	},
    	global: {
    		// replace this path with the path to your own translated file
    		localization: "https://cdn.webdatarocks.com/loc/es.json"
    	}
    });
    </script>
    

    Open live demo

    b) If you want to set a specific language for a report, add localization property to report:

    <script>
    var pivot = new WebDataRocks({
    	container: "#wdr-component",
    	toolbar: true,
    	report: {
    		dataSource: {
    			filename: "https://cdn.webdatarocks.com/data/data.csv"
    		},
    		// replace this path with the path to your own translated file
    		localization: "https://cdn.webdatarocks.com/loc/es.json"
    	}
    });
    </script>
    

Please note, language can also be changed by specifying inline JSON object in localization property instead of URL to JSON file. Such JSON object should be just the same as translated file contents.