This is a migrated thread and some comments may be shown as answers.

How to load kendo.messages.xx-xx.min.js files from local disk when localization

2 Answers 514 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Nick
Top achievements
Rank 1
Nick asked on 26 Oct 2018, 08:04 AM
I am trying to load the culture files(kendo.messages.xx-xx.min.js) from the local disk, is there a good way to do that?

The method you provided is like following:
var baseUrl = 'https://kendo.cdn.telerik.com/2018.3.1017/js/messages/kendo.messages.';
$.getScript(baseUrl + "zh-CN.min.js", function () {
kendo.ui.progress($("#grid"), false);
CreateGrid();
});

I would like to load it like following, but it didn't work for me.
$.getScript("../culture/zh-CN.min.js", function () {
kendo.ui.progress($("#grid"), false);
CreateGrid();
});

2 Answers, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 30 Oct 2018, 08:02 AM
Hello Nick,

You could take a look at the following links for more information about the getScript method and its limitations:  
If the language will not be changed dynamically, you can load the script file directly on the page:
<script src="kendo.messages.bg-BG.js"></script>

Hope this helps.


Regards,
Konstantin Dikov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Nick
Top achievements
Rank 1
answered on 30 Oct 2018, 09:20 AM

Hi Konstantin, this problem is solved. I added the script section dynamically. 

 

var script = document.createElement('script');
script.onload = function () {
    kendo.ui.progress($("#grid"), true);
    kendo.ui.progress($("#grid"), false);
    CreateGrid();
};
script.src = "../scripts/KendoLanguages/kendo.messages." + locale + ".min.js";

if(document.head){
    document.head.appendChild(script);
}

Tags
Grid
Asked by
Nick
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Nick
Top achievements
Rank 1
Share this question
or