Selecting Month doesn work if using Multi Language

Hello,

I'm facing a weird problem using Schedule control. When I click on a month button it doesn't work (don't show selected month on schedule). But only when I'm using this code:


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",
"today": "Hoje",
"newEvent": "Novo Agendamento",
"save": "Salvar",
"cancel": "Cancelar",
"delete": "Excluir"
},
}
});
loadCultureFiles('pt');
scheduleObject.locale = 'pt';
});









If I remove language code it works fine. Can you help me?

Thank you.

MC





6 Replies 1 reply marked as answer

MC Maikel Cordeiro March 19, 2021 12:42 AM UTC

This is loadCultureFiles function.




  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 + '/../js/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);
    }
  }


HB Hareesh Balasubramanian Syncfusion Team March 19, 2021 03:05 PM UTC

Hi Maikel, 

Greetings from Syncfusion Support..! 

We have prepared a sample to reproduce your reported issue “culture is not properly loading in the Scheduler while you include the language file” unfortunately, we were unable to reproduce your reported problem and the sample can be downloaded from the following link. We have tried the following ways to replicate the issue at our end. 

  1. We have ensured your reported problem by applying “pt” as locale for the Scheduler but the cultures are properly loading without any issue at our end.


        loadCultureFiles(); 
        ej.base.L10n.load({ 
            "pt": { 
                "schedule": { 
                     . 
                     . 
                }, 
                "recurrenceeditor": { 
                    . 
                    . 
                }, 
                "calendar": { 
                    "today": "Hoje" 
                } 
            } 
        }); 
        var data = [{ 
            Id: 1, 
            Subject: 'Meeting', 
            StartTime: new Date(2018, 3, 4, 9, 30), 
            EndTime: new Date(2018, 3, 4, 12, 30), 
            IsAllDay: false 
        }]; 
        var scheduleObj = new ej.schedule.Schedule({ 
            width: '100%', 
            height: '650px', 
            currentView: 'Week', 
            locale: "pt", 
            views: [ 
                { option: 'Day' }, 
                { option: 'Week' }, 
                { option: 'Month' }, 
                { option: 'TimelineDay' }, 
                { option: 'TimelineWeek' }, 
                { option: 'TimelineMonth' } 
            ], 
            selectedDate: new Date(2018, 3, 4), 
            eventSettings: { 
                dataSource: data 
            }, 
        }); 
        function loadCultureFiles() { 
            var files = ['ca-gregorian.json', 'numbers.json', 'numberingSystems.json', 'timeZoneNames.json']; 
            var loader = ej.base.loadCldr; 
            var loadCulture = function (prop) { 
                var val, ajax; 
                ajax = new ej.base.Ajax('./' + 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); 
            } 
        } 
 
Kindly refer to the above sample, also share the below details to validate your reported issue and serve you better. 
  • Kindly confirm whether our shared sample is working properly or not at your end?
  • If the issue still exists, kindly share the entire scheduler rendering code snippets at our end.
  • If possible, replicate the issue in the above sample.
  • Share the issue replicating sample (if possible) in order to validate further at our end.

We will be happy to assist you..! 

Regards, 
Hareesh 


Marked as answer

MC Maikel Cordeiro March 19, 2021 03:17 PM UTC

Hi, the example is raising errors and it's not working:




HB Hareesh Balasubramanian Syncfusion Team March 22, 2021 11:31 AM UTC

Hi Maikel, 

Thanks for the update. 

We have validated your shared error snippet at our end and suspect that you have not run the previously updated sample using the “gulp serve” command which could be the reason for your reported problem. Kindly try the below commands to run our previously provided sample. 

  • npm install
  • gulp serve

It is mandatory to install the packages to load the culture properly, kindly try the above solution and get back to us if you need any further assistance. 

Regards, 
Hareesh 



MC Maikel Cordeiro March 22, 2021 12:38 PM UTC

No, I'm using vanila javascript.

Is there a way to fix that using javascript files only?


HB Hareesh Balasubramanian Syncfusion Team March 23, 2021 05:48 PM UTC

Hi Maikel, 

Thanks for the update. 

If you need to bind the culture files for the scheduler using JSON GET method then we need to serve the sample. So it is mandatory to run the sample using local/hosting server, then only those culture files will be loaded to the Scheduler. In our previously provided sample, we are using the Ajax method for loading the culture files. 

If you have any other concerns please revert for further assistance. 

Regards, 
Hareesh  


Loader.
Up arrow icon