npm install cldr-data |
<div>
<ejs-grid id="Grid" locale="pl" dataSource="ViewBag.DataSource" allowPaging="true" allowGrouping="true">
<e-grid-pagesettings pageCount="4" pageSize="5"></e-grid-pagesettings>
...
</ejs-grid>
</div>
<script>
ej.base.L10n.load({
'pl': {
'grid': {
'EmptyRecord': 'Pusty rekord',
'GroupDropArea': 'Obszar zrzutu grupy',
},
'pager': {
'currentPageInfo': '{0} z {1} stron',
'totalItemsInfo': '({0} wiadomości)',
}
}
});
function loadCultureFiles(name) {
ej.base.setCulture(name);
var files = ['ca-gregorian.json', 'numbers.json', 'timeZoneNames.json'];
if (name === 'pl') {
files.push('numberingSystems.json');
}
var loader = ej.base.loadCldr;
var loadCulture = function (prop) {
var val, ajax;
if (name === 'pl' && prop === files.length - 1) {
ajax = new ej.base.Ajax(location.origin + '/../../scripts/cldr-data/supplemental/' + files[prop], 'GET', false);
} else {
ajax = new ej.base.Ajax(location.origin + '/../../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);
}
}
document.addEventListener('DOMContentLoaded', function () {
loadCultureFiles('pl');
});
</script>
|