Setting the locale to FR

Hello,

Could you show me how to choose the fr format, set the locale to FR for the daterange picker, and eventually for all of the project please ?
I knew how to do it with asp.net, and examples where provided way back.

Thank's

1 Reply

SP Sureshkumar P Syncfusion Team May 28, 2020 10:19 AM UTC

Hi Marc, 
 
Greetings from Syncfusion support.  
 
Based on your shared information, we suspect that you want to render the daterangepicker component with “Fr” culture. Please use below code example to achieve your requirement.  
 
<ejs-daterangepicker id="range"></ejs-daterangepicker> 
 
<script> 
    document.addEventListener('DOMContentLoaded'function () { 
        rangeObject = document.getElementById('range').ej2_instances[0];        
        loadCultureFiles('fr'); 
        rangeObject.locale = 'fr'; 
 
    }); 
 
    function loadCultureFiles(name) { 
        var files = ['ca-gregorian.json''numbers.json''timeZoneNames.json''numberingSystems.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 + 'scripts/cldr-data/supplemental/' + files[prop], 'GET'false); 
            } else { 
                ajax = new ej.base.Ajax(location.origin + location.pathname + '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); 
        } 
    } 
 
</script> 
 
<style> 
    body { 
        min-height600px; 
    } 
</style> 
 
 
We have created the sample based on your requirement. please find the sample here: https://www.syncfusion.com/downloads/support/directtrac/general/ze/DateRangePickerLocale1670197164  
 
To know more about globalization in daterangepicker, please refer the documentation link: https://ej2.syncfusion.com/aspnetcore/documentation/daterangepicker/globalization/?no-cache=1  
 
Regards, 
Sureshkumar P 


Loader.
Up arrow icon