Localization not working

Resolved
Alberto Nudman asked on February 4, 2017

Hi
I cannot make localization work. The code I am using in my HTML is below.
I have downloaded and placed the file "es.json" both in the same folder where the HTML lies, AND in the flexmonster/ subfolder
The component shows fine, but no localization.
 
<script type="text/javascript">

        var pivot = $("#pivotContainer1").flexmonster({
        toolbar: true,
           report: {
                dataSource: {
                    dataSourceType: "ocsv",
                    filename: "http://olap.flexmonster.com/compressor/demo.php"
                },
                slice: {
                    rows: [
                        { uniqueName: "Country" },
                        { uniqueName: "Category" },
                        { uniqueName: "[Measures]" }
                    ],
                    columns: [
                        { uniqueName: "Color" }
                    ],
                    measures: [
                        { uniqueName: "Price", aggregation: "sum", format: "currency"},
                        { uniqueName: "Discount", aggregation: "average"}
                    ]    
                }
            },
            localization: "es.json",
            licenseKey: "Z7NI-XCEA02-6O6M67-2R1F4K"

        });

5 answers

Public
Roman Petrusha Roman Petrusha Flexmonster February 4, 2017

Hi Alberto,

You can try to use absolute path to the file like http://your_server/your_folder/es.json
or
add localization directly in the page

$("#pivotContainer").flexmonster({
   global: {
     localization: {
        "calculatedView": {
           "measureBox": "Deplacez valeur a la formule",
           "measureName": "Nom de la valeur",
           "formula": "Formule"
         }
     }
  },
  ... // data source, options, etc
});

Please find more information here: http://www.flexmonster.com/doc/localizing-component/
Regards,
 Roman

Public
Alberto Nudman February 4, 2017

Dear Roman,
There's no way I can get the localization to work. I am using ASP.Net
If I type in the absolute URL (http://localhost:52832/loc/es.json), I get an error ("Object instance").
I have changed the file's extension to txt (es.txt), and typing http://localhost:52832/loc/es.txt, I can see the file's contents.
Anyway, the component does not take the localization, nor the json, nor the txt. Nor the report setting, nor the global setting.
And making the localization one by one would be a nightmare... there are some 50 reports!

Public
Roman Petrusha Roman Petrusha Flexmonster February 5, 2017

Hi Alberto,

Please look at this demo on our web-site https://www.flexmonster.com/demos/js/localization/
or try to modify it using JSFiddle http://jsfiddle.net/flexmonster/Lz8sjbnf/15/

I think your localization doesn't work because you place localization parameter in the wrong place. Please try to move localization parameter into the report object.

If you need to set one parameter like localization to all your reports you don't need to change all reports but define it inside global parameter

var pivot = $("#pivot-container").flexmonster({
   global: {
     localization: "loc/es.json"
   },
   report: {
.......
  }
});

Does it help?

Regards,
  Roman

Public
Alberto Nudman February 5, 2017

Hi
Unfortunately, there's no way I can get this localization thing to work. Is it any chance the web server I am using (IIS) prevents something to happen?

Public
Dmytro Zvazhii Dmytro Zvazhii Flexmonster February 6, 2017

Hello Alberto,
We want to suggest you trying to stream the localization data to the Component. Here is a sample project with the workaround - https://monosnap.com/file/pKh5KNGUS3VYI2cVME9TAxsPiSiQVD.
Please let us know if it works for you.
Regards,
Dmytro.

Please login or Register to Submit Answer