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:
- Download template JSON file. It contains all labels that are used in WebDataRocks and English values for them.
- Translate values into the language you want. For example, you want a 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). - Use your translated file to change the language in the pivot component. It can be done in any of the following ways:
a) If you want to set one language for all reports, add
a 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>
b) If you want to set a specific language for a report, add a
localization
property toreport
:<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 localization