How to LoadLocaleData in .net core

Hi,

I'm looking a solution like following link. I've searched but i couldn't find a sample loading from a localfile. Is there an option translating compnents from a pre-translated file.

Bests,
Tümer

https://www.syncfusion.com/forums/149195/grid-globalization


2 Replies

BS Banupriya Selvaraj Syncfusion Team February 24, 2020 02:23 PM UTC

Hi Tumer, 

Thanks for contacting Syncfusion Support. 

We are creating a custom sample based on your requirement. We will update further details on February 25, 2020. 

Until then we appreciate your patience. 

Regards, 
Banupriya 



BS Banupriya Selvaraj Syncfusion Team February 25, 2020 12:45 PM UTC

Hi Tumer,  

Based on your request, we have prepared a sample in which we have loaded the localization files to apply the “de” culture in Grid.   

You can also find localization files for all other cultures in our ej2-locale github repository. Please refer the below link below, 

Please refer the below highlighted code example to load localization files using Ajax. 

<ejs-grid> 
… 
</ejs-grid> 

<script> 
    document.addEventListener('DOMContentLoaded', function () { 
        loadLocaleFiles(); 
        loadCultureFiles('de'); 
    });   

    function loadLocaleFiles() { 
        var ajax; 
        ajax = new ej.base.Ajax(location.origin + '/../../de.json', 'GET', false);   //load the de json culture file  
        ajax.send().then((e) => { 
            var loader = JSON.parse(e); 
            ej.base.L10n.load( 
                loader 
            ); 
            ej.base.setCulture('de');      //Set the culture for the EJ2 components  
        }); 
    } 

//Function for loading locale files based on culture name 
   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; 
            if (name === 'ar' && prop === files.length - 1) { 
                ajax = new ej.base.Ajax(location.origin + location.pathname + '/../../node_modules/cldr-data/supplemental/' + files[prop], 'GET', false); 
            } else { 
                ajax = new ej.base.Ajax(location.origin + location.pathname + '/../../node_modules/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); 
       
    }</script> 

To know more about localization and globalization, please refer the below documentation links. 

Please get back to us if you need assistance with this. 

Regards,  
Banupriya 


Loader.
Up arrow icon