Setting up globalization in Schedule - ASP.NET Core

Hello,

I'm following this tutorial for setting up globalization in the schedule component: https://ej2.syncfusion.com/aspnetcore/documentation/schedule/localization.html

When I run npm install cldr-data --save no folder was created in \scripts\cldr-data or /wwwroot/scripts/cldr-data. I only got a node_modules in the root of my project and inside of it I have a cldr-data folder.

So I created a script folder inside my project and copied the cldr-data folder to it.



When my page that have a Schedule component loads, the following error appears in the console. The Schedule appears normally, but without the translation I need.



And this is my script on the page:

        document.addEventListener('DOMContentLoaded', function () {
            var scheduleObject = document.getElementById('schedule').ej2_instances[0];
            var L10n = ej.base.L10n;
            L10n.load({
                "pt": {
                    "schedule": {
                        "day": "Dia",
                        "week": "Semana",
                        "workWeek": "Semana de trabalho",
                        "month": "Mês",
                    },
                }
            });
            loadCultureFiles('pt');
            scheduleObject.locale = 'pt';
        });

        function loadCultureFiles(name) {
            var files = ['ca-gregorian.json', 'numbers.json', 'timeZoneNames.json'];
            if (name === 'ar') {
                files.push('numberingSystems.json');
            }
            var loader = ej.base.loadCldr;
            var loadCulture = function (prop) {
                var val, ajax;
                ajax = new ej.base.Ajax(location.origin + '/../scripts/cldr-data/main/' + name + '/' + files[prop], 'GET', false);
                ajax.onSuccess = function (value) {
                    val = value;
                };
                ajax.send();
                loader(JSON.parse(val));
            };
            for (var prop = 0; prop < files.length; prop++) {
                loadCulture(prop);
            }
        }

Any ideas what I am doing wrong?

3 Replies

KK Karthigeyan Krishnamurthi Syncfusion Team October 18, 2018 07:41 AM UTC

Hi Gregory, 
 
Thank you for contacting Syncfusion support. 
 
We have checked your scenario by copy pasting the cldr-data folder outside the wwwroot and able to reproduce the reported issue. On inspecting, we found that not all the culture folders from /wwwroot/scripts/cldr-data are copied to \scripts\cldr-data which is the cause for the issue. Placing the scripts\cldr-data folder inside / outside the wwwroot will work and for the same we have prepared the below sample for your reference. 
 
Kindly ensure that /wwwroot/scripts/cldr-data and \scripts\cldr-data have same folders in your sample. 
 
Regards, 
Karthigeyan 



GP Gregory Perozzo October 18, 2018 12:11 PM UTC

Karthigeyan,

Thank you very much for your help! I already did what you told on your example and my project now have globalization successfully configured.

You were very fast and right in your response.


Thank you again and have a nice day!



KK Karthigeyan Krishnamurthi Syncfusion Team October 19, 2018 03:56 AM UTC

Hi Gregory, 
 
We are happy that our solution resolved your issue. 
 
Regards, 
Karthigeyan 


Loader.
Up arrow icon