function LocalizeEJ2(name) {
ej.base.L10n.load(translations);
function loadCultureFiles() {
ej.base.setCulture(name);
var files = ['ca-gregorian.json', 'numbers.json','timeZoneNames.json'];
if (name != 'en') {
files.push('numberingSystems.json');
}
var loader = ej.base.loadCldr;
var loadCulture = function (prop) {
var val, ajax;
if (name != 'en' && prop === files.length - 1) {
ajax = new ej.base.Ajax(location.origin + '/localization/cldr-data/supplemental/' + files[prop], 'GET', false);
} else {
ajax = new ej.base.Ajax(location.origin + '/localization/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);
}
}
document.addEventListener('DOMContentLoaded', function () {
ej.base.setCulture(name);
loadCultureFiles(name);
});
}
<ejs-datepicker id="datepickerfrom" format="yyyy-MM-dd" value="@DateTime.Now.Date">
<ejs-datepicker id="datepicker" format="yyyy-MM-dd" value="@DateTime.Now.Date"></ejs-datepicker>
<script>
document.addEventListener('DOMContentLoaded', function () {
datepicker = document.getElementById('datepicker').ej2_instances[0];
var L10n = ej.base.L10n;
L10n.load({
'de': {
'datepicker': {
placeholder: 'Wählen Sie ein Datum',
today: 'heute'
}
}
});
loadCultureFiles('de');
ej.base.setCulture('de');
});
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 + '/../../cldr-data/supplemental/' + files[prop], 'GET', false);
} else {
ajax = new ej.base.Ajax(location.origin + location.pathname + '/../../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>
|