Localization

Localization in PivotChart

We can localize the PivotChart controls text with a collection of localized strings using ej.PivotChart.Locale for different cultures. By default, the PivotChart control is localized in “en-US”.

Following code example illustrates on how to localize PivotChart based on “French” culture.

  • javascript
  • <body>
        <div ng-controller="PivotChartCtrl">
            <div id="PivotChart1" ej-pivotchart e-locale="fr-FR"/>
        </div>
        <script>
            angular.module('PivotChartApp', ['ejangular']).controller('PivotChartCtrl', function ($scope) {
                ///..
            });
            ej.PivotChart.Locale["fr-FR"] = {
                Measure: "Mesure",
                Row: "Rangée",
                Column: "Colonne",
                Value: "Valeur",
                Expand: "Développer",
                Collapse: "Effondrement",
                Exit: "Quitter"
            };
        </script>
    </body>

    Following table localizes the in-built keywords to “French” culture for PivotChart.

    Keywords Values
    Measure “Mesure”
    Row "Rangée "
    Column "Colonne”
    Value "Valeur "
    Expand "Développer "
    Collapse "Effondrement "
    Exit “Quitter "

    Localization and Globalization of Cube Info (Client Mode)

    Content displayed within the PivotChart control are obtained from the OLAP Cube. So following are the steps that needs to be done to get the localized and globalized Cube content.

    • To get localized data from OLAP Cube, we need to set “Locale Identifier” in the connection string to a specific culture in the “data” property present inside “dataSource”.
    • To bind the globalized content in PivotChart control, we need to set “locale” property to a specific culture and want to refer specific culture file in the sample.

    NOTE

    Culture files are present under “[installed drive]:\Users\ [user name]\AppData\Local\Syncfusion\EssentialStudio\X.X.X.X\JavaScript\samples\web\scripts\cultures”.

  • html
  • <div ng-controller="PivotChartCtrl">
        <div id="PivotChart1" ej-pivotchart e-dataSource="dataSource" e-locale="fr-FR"/>
    </div>
    <script>
        angular.module('PivotChartApp', ['ejangular']).controller('PivotChartCtrl', function ($scope) {
                $scope.dataSource = {
                data: "http://bi.syncfusion.com/olap/msmdpump.dll; Locale Identifier=1036;", //data
                //..
            };
            $scope.dataSource = $scope.dataSource;
        });
    </script>

    Localization and Globalization of Cube Info (Server Mode)

    Content displayed within the PivotChart control are obtained from the OLAP Cube. So following are the steps that needs to be done to get the localized and globalized Cube content.

    • To get the localized string based on different cultures, from OLAP Cube, we need to set “Locale Identifier” in the connection string to a specific culture.
    • To bind the globalized content in PivotChart control, we need to set “Culture” and “OverrideDefaultFormatStrings” properties in OlapDataManager class to a specific culture.
  • c#
  • //1036 refers to “fr-FR” culture.
    string connectionString = "Data Source=localhost; Initial Catalog=Adventure Works DW; Locale Identifier=1036;";
    DataManager = new OlapDataManager(connectionString);
    DataManager.Culture = new System.Globalization.CultureInfo(1036);
    DataManager.OverrideDefaultFormatStrings = true;