Globalization ES

Hi,

i am trying to change localization to spanish like the example in the documentaion:
https://ej2.syncfusion.com/documentation/daterangepicker/globalization.html?lang=es5

can you explain me how to get it to work? with DE like the example is working fine.

But if i change it to es, it throws a undefined error.

Thanks in advance
Miguel

3 Replies

SK Suman Kumar G Syncfusion Team August 24, 2018 10:15 AM UTC

Hi Miguel,   
 
Thanks for contacting Syncfusion Support. 
 
In order to globalize the DateRangePicker component, we need to load the specific culture (es) CLDR JSON data before the component is initialized in order to parse and localize the DateRangePicker component to the required culture. Please follow the below steps to localize the DateRangePicker component to es locale. 
 
  1. Run the command npm install cldr-data --save within the sample folder.
  2. Once the packages are  installed, within the node modules folder, you can find the cldr-data folder.
  3. Now we need to load the files “numbers.json, timeZoneNames.json, ca-gregorian.json” file from “node_modules/cldr-data/main/es/” location as shown in the below code snippet.
 
   loadCultureFiles('es'); 
   var daterangepicker = new ej.calendars.DateRangePicker({ 
       locale: 'es' 
    }); 
    daterangepicker.appendTo('#element'); 
 
  function loadCultureFiles(name) { 
        var files = ['ca-gregorian.json', 'numbers.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); 
        } 
    } 
 
For your convenience, we have also created a sample for globalizing DateRangePicker component in ES culture and attached it in the below link. Please check it. 
 
 
Please let us know if you need any further assistance. 
  
Regards, 
SumanKumar G 



MV Miguel Varela Rodriguez August 24, 2018 11:35 AM UTC

thank you that's basically what i did and i get the following error in console ( see screenshot attached).



Attachment: error_249669bc.zip


BM Balaji M Syncfusion Team August 27, 2018 12:14 PM UTC

Hi Miguel,   
 
Sorry for the inconvenience caused. 
 
We have checked with the reported issue and this issue may occur only with two cases. Either the path location specified for the CLDR JSON data in the script section must be wrong or the name of the JSON data must be misspelled within the JSON data loading method in the script section. So, please ensure than correct patch location and names of the CLDR data is specified correctly in application to resolve this issue at your end. 
 
If still the issue persist or this is not your case, then please get back to us with an issue reproducing local sample so that we can validate what is went wrong with your application and provide an exact solution to overcome this issue at your end. 
 
Regards, 
M. Balaji 
  


Loader.
Up arrow icon