New to Kendo UI for jQuery? Download free 30-day trial

Translate PivotGrid Messages

Environment

Product Progress® Kendo UI® PivotGrid for jQuery
Operating System Windows 10 64bit
Browser Google Chrome
Browser Version 61.0.3163.100

Description

How can I translate the messages of a Kendo UI PivotGrid?

Solution

The following example demonstrates how to translate the messages of a Kendo UI PivotGrid widget.

<div id="example">
    <div id="pivotgrid"></div>
    <script>
      //messages
      kendo.ui.PivotSettingTarget.fn.options.messages = {
        empty: "Translated 'Drop fields here'"
      };

      kendo.ui.PivotFieldMenu.fn.options.messages = {
        info: "Translated 'info'",
        sortAscending: "Translated 'sortAsc'",
        sortDescending: "Translated 'sortDesc'",
        filterFields: "Translated 'filterFields'",
        filter: "Translated 'filter'",
        include: "Translated 'include'",
        title: "Translated 'title'",
        clear: "Translated 'clear'",
        ok: "Translated 'ok'",
        cancel: "Translated 'cancel'",
        operators: {
            contains: "Translated 'contains'",
            doesnotcontain: "Translated 'doesnotcontain'",
            startswith: "Translated 'startswith'",
            endswith: "Translated endswith'",
            eq: "Translated 'eq'",
            neq: "Translated 'neq'"
        }
      };

      kendo.ui.PivotConfigurator.fn.options.messages = {
        measures: "Translated 'measures'",
        columns: "Translated 'columns'",
        rows: "Translated 'rows'",
        measuresLabel: "Translated 'measuresLabel'",
        columnsLabel: "Translated 'columnsLabel'",
        rowsLabel: "Translated 'rowsLabel'",
        fieldsLabel: "Translated 'fieldsLabel'"
      };

      kendo.ui.PivotGrid.fn.options.messages = {
        measureFields: "Translated measure fields",
        columnFields: "Translated column fields",
        rowFields: "Translated row fields"
      };
    </script>

    <script>
        $(document).ready(function () {
            var pivotgrid = $("#pivotgrid").kendoPivotGrid({
                filterable: true,
                columnWidth: 200,
                height: 580,
                dataSource: {
                    type: "xmla",
                    columns: [{ name: "[Date].[Calendar]", expand: true }, { name: "[Product].[Category]" } ],
                    rows: [{ name: "[Geography].[City]" }],
                    measures: ["[Measures].[Internet Sales Amount]"],
                    transport: {
                        connection: {
                            catalog: "Adventure Works DW 2008R2",
                            cube: "Adventure Works"
                        },
                        read: "https://demos.telerik.com/olap/msmdpump.dll"
                    },
                    schema: {
                        type: "xmla"
                    },
                    error: function (e) {
                        alert("error: " + kendo.stringify(e.errors[0]));
                    }
                }
            }).data("kendoPivotGrid");
        });
    </script>
</div>

See Also

In this article