We have updated WebDataRocks EULA, effective as of April 18, 2024. Learn more about what's changed.
Documentation menu

Language localization

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.

Create a custom localization file

Follow the steps below to create your own localization file based on our template:

Step 1. Download template JSON file. It contains all labels that are used in WebDataRocks and English values for them.

Step 2. 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).

Localize a specific report

To set a specific language for a report, add a report.localization property with the necessary localization:

  • Set the localization as a URL to the file:
    report: {
    dataSource: {
    filename: "https://cdn.webdatarocks.com/data/data.csv"
    },
    // Replace this file with your own localization file
    localization: "https://cdn.webdatarocks.com/loc/es.json"
    }
  • Set the localization as an inline JSON object:
    report: {
    dataSource: {
    filename: "https://cdn.webdatarocks.com/data/data.csv"
    },
    // Replace the translation below with your own labels
    localization: {
    fieldsList: {
    flatHierarchyBox: "Seleccionar y organizar columnas",
    hierarchyBox: "Seleccionar dimensiones",
    filterBox: "Filtros del Informe",
    // Other labels
    }
    }

    }

Set localization for all reports

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

  • Set the localization as a URL to the file:
    let pivot = new WebDataRocks({
    container: "#wdr-component",
    report: {
    // Your report
    },
    global: {
    // Replace this file with own localization file
    localization: "https://cdn.webdatarocks.com/loc/es.json"
    }
    });
  • Set the localization as an inline JSON object:
    let pivot = new WebDataRocks({
    container: "#wdr-component",
    report: {
    // Your report
    },
    global: {
    // Replace the translation below with your own labels
    localization: {
    fieldsList: {
    flatHierarchyBox: "Seleccionar y organizar columnas",
    hierarchyBox: "Seleccionar dimensiones",
    filterBox: "Filtros del Informe",
    // Other labels
    }
    }
    }

    });

Open a live demo.

Learn more about the Global Object.