<div>
<ejs-grid id="Grid" dataSource="ViewBag.DataSource" allowGrouping="true" allowFiltering="true" locale="de-DE" allowPaging="true">
<e-grid-columns>
...
</e-grid-columns>
</ejs-grid>
</div>
<script>
ej.base.L10n.load({
'de-DE': {
'grid': {
'EmptyRecord': 'Keine Aufzeichnungen angezeigt',
...
'Items': 'Artikel'
},
'pager': {
'currentPageInfo': '{0} von {1} Seiten',
...
'previousPagerTooltip': 'Zum vorherigen Pager'
}
}
});
</script> |
<ejs-grid id="Grid" allowPaging="true" allowGrouping="true">
...
</ejs-grid>
<script>
function loadCultureFiles() {
var ajax = new ej.base.Ajax(location.origin + '/../../scripts/src/de-DE.json', 'GET', true); //load the de-DE json culture file
ajax.send().then((e) => {
var culture = JSON.parse(e);
ej.base.L10n.load(
culture
);
ej.base.setCulture('de-DE'); //Set the culture for the EJ2 components
});
}
document.addEventListener('DOMContentLoaded', function () {
loadCultureFiles();
});
</script> |
<ejs-grid id="Grid" dataSource="ViewBag.dataSource" allowPaging="true" >
<e-grid-pagesettings pageCount="5"></e-grid-pagesettings>
<e-grid-columns>
<e-grid-column field="OrderID" headerText="Order ID" textAlign="Right" width="120"></e-grid-column>
<e-grid-column field="CustomerID" headerText="Customer Name" width="150"></e-grid-column>
<e-grid-column field="OrderDate" headerText=" Order Date" format="yMd" width="130"></e-grid-column>
<e-grid-column field="Freight" headerText="Freight" format="C2" width="120"></e-grid-column>
<e-grid-column field="StockInUnits" headerText="Stock" format="N0" width="140"></e-grid-column>
</e-grid-columns>
|
npm install cldr-data |
<div>
<ejs-grid id="Grid" locale="it" 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({ //for loading translations
'de': {
'grid': {
'EmptyRecord': 'Keine Aufzeichnungen angezeigt',
'GroupDropArea': 'Ziehen Sie einen Spaltenkopf hier, um die Gruppe ihre Spalte',
},
'pager': {
'currentPageInfo': '{0} von {1} Seiten',
'totalItemsInfo': '({0} Beiträge)',
}
}
});
<script>
function loadCultureFiles(name) {
var files = ['ca-gregorian.json', 'numbers.json', 'timeZoneNames.json', 'currencies.json'];
var loadCulture = function (prop) {
var val, ajax;
ajax = new ej.base.Ajax(location.origin + '/../../scripts/cldr-data/main/' + name + '/' + files[prop], 'GET', true);
ajax.onSuccess = function (value) {
val = value;
ej.base.loadCldr(JSON.parse(val));
};
ajax.send();
ej.base.setCulture('it');
ej.base.setCurrencyCode('EUR');
};
for (var prop = 0; prop < files.length; prop++) {
loadCulture(prop);
}
}
document.addEventListener('DOMContentLoaded', function () {
loadCultureFiles('it');
});
});
</script>
|
<div>
<ejs-grid id="Grid" locale="it" dataSource="ViewBag.DataSource" allowPaging="true" allowGrouping="true">
<e-grid-pagesettings pageCount="4" pageSize="5"></e-grid-pagesettings>
<e-grid-columns>
...
</e-grid-columns>
</ejs-grid>
</div>
<script>
ej.base.L10n.load({ //for loading translations
'it': {
'grid': {
'EmptyRecord': 'Record vuoto',
'GroupDropArea': 'Gruppo Drop Area',
},
'pager': {
'currentPageInfo': '{0} di {1} pagine',
'totalItemsInfo': '({0} post)',
}
}
});
function loadCultureFiles(name) { //for applying number format and others
ej.base.setCulture(name);
var files = ['ca-gregorian.json', 'numbers.json', 'timeZoneNames.json'];
if (name === 'it') {
files.push('numberingSystems.json');
}
var loader = ej.base.loadCldr;
var loadCulture = function (prop) {
var val, ajax;
if (name === 'it' && 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('it');
});
</script>
|
<div>
<ejs-grid id="Grid" locale="it" dataSource="ViewBag.DataSource" created="created" toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Cancel", "Update" })" allowPaging="true" allowGrouping="true">
<e-grid-pagesettings pageCount="4" pageSize="5"></e-grid-pagesettings>
<e-grid-editSettings allowAdding="true" allowDeleting="true" allowEditing="true" mode="Normal"></e-grid-editSettings>
<e-grid-columns>
<e-grid-column field="OrderID" headerText="Order ID" textAlign="Right" width="120"></e-grid-column>
...
</e-grid-columns>
</ejs-grid>
</div>
<script>
function created(e) {
this.getColumns()[0].validationRules = { required: [true, 'Questo campo è obbligatorio'] }
}
...
</script>
|
<ejs-dropdownlist id="employees" dataSource="@ViewBag.data" placeholder="Select an employee" popupHeight="270px"
noRecordsTemplate="@Html.Raw("<span class='norecord'> Nessun record trovato </span>")">
<e-dropdownlist-fields text="Name"></e-dropdownlist-fields>
</ejs-dropdownlist> |
<div>
<ejs-grid id="Grid" locale="it" dataSource="ViewBag.DataSource" created="created" toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Cancel", "Update" })" allowPaging="true" allowGrouping="true">
<e-grid-pagesettings pageCount="4" pageSize="5"></e-grid-pagesettings>
<e-grid-editSettings allowAdding="true" allowDeleting="true" allowEditing="true" mode="Normal"></e-grid-editSettings>
<e-grid-columns>
<e-grid-column field="OrderID" headerText="Order ID" textAlign="Right" width="120"></e-grid-column>
...
</e-grid-columns>
</ejs-grid>
</div>
<script>
function created(e) {
this.getColumns()[0].validationRules = { required: [true, 'Questo campo è obbligatorio'] }
}
...
</script>
|
<div class="control-wrapper">
<div id="default" style='padding-top:75px;'>
<ejs-dropdownlist id="customers" query="new ej.data.Query().select('CustomerID','OrderID').take(10)" placeholder="Select a customer" locale="it-IT" popupHeight="200px">
<e-dropdownlist-fields text="CustomerID" value="OrderID"></e-dropdownlist-fields>
<e-datamanager url="http://js.syncfusion.com/demos/ejServices/Wcf/Northwind.svc/Orders/" crossDomain="true"></e-datamanager>
</ejs-dropdownlist>
</div>
</div>
<script>
ej.base.L10n.load({
'it-IT': {
'dropdowns': {
'noRecordsTemplate': "Nessun record trovato",
'actionFailureTemplate': "La richiesta non è riuscita"
}
}
});
</script |
Hi Costa,Query: Yes, It works. But, unfortunately, works alternately. Either culture(cldr-data) or text translation(https://github.com/syncfusion/ej2-locale). I couldn't get them to work at the same time.We have validated your query and created a sample based on your requirement. Here, we have created a sample with both loading culture files(for formats., and others) and loading translations(text translations). Please find the below code example and sample for your reference.[code example]
<div><ejs-grid id="Grid" locale="it" dataSource="ViewBag.DataSource" allowPaging="true" allowGrouping="true"><e-grid-pagesettings pageCount="4" pageSize="5"></e-grid-pagesettings><e-grid-columns>...</e-grid-columns></ejs-grid></div><script>ej.base.L10n.load({ //for loading translations'it': {'grid': {'EmptyRecord': 'Record vuoto','GroupDropArea': 'Gruppo Drop Area',},'pager': {'currentPageInfo': '{0} di {1} pagine','totalItemsInfo': '({0} post)',}}});function loadCultureFiles(name) { //for applying number format and othersej.base.setCulture(name);var files = ['ca-gregorian.json', 'numbers.json', 'timeZoneNames.json'];if (name === 'it') {files.push('numberingSystems.json');}var loader = ej.base.loadCldr;var loadCulture = function (prop) {var val, ajax;if (name === 'it' && 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('it');});</script>Please find the sample in below link.Sample link: http://www.syncfusion.com/downloads/support/directtrac/general/ze/TestSampleLocaleit158997662Please get back to us if you need further assistance.Regards,J Mohammed Farook
<script>
document.addEventListener('DOMContentLoaded', function () {
ej.base.setCulture('bn');
ej.base.setCurrencyCode('BDT');
daterangepicker = document.getElementById('daterangepicker').ej2_instances[0];
grid = document.getElementById('Grid').ej2_instances[0];
var L10n = ej.base.L10n;
L10n.load({
'bn': {
'grid': {
'EmptyDataSourceError': 'DataSource darf bei der Erstauslastung nicht leer sein, da Spalten aus der dataSource im AutoGenerate Spaltenraster',
'EmptyRecord': 'Keine Aufzeichnungen angezeigt',
'GroupDropArea': 'Ziehen Sie einen Spaltenkopf hier, um die Gruppe ihre Spalte',
'Item': 'Artikel',
'Items': 'Artikel',
'UnGroup': 'Klicken Sie hier, um die Gruppierung aufheben'
},
'daterangepicker': {
placeholder: 'Einen Bereich auswählen',
startLabel: 'Wählen Sie Startdatum',
endLabel: 'Wählen Sie Enddatum'
}
}
});
loadCultureFiles('bn');
});
function loadCultureFiles(name) {
var files = ['ca-gregorian.json', 'currencies.json', 'numbers.json', 'timeZoneNames.json'];
if (name === 'bn') {
files.push('numberingSystems.json');
}
var loader = ej.base.loadCldr;
var loadCulture = function (prop) {
var val, ajax;
if (name === 'bn' && 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>
|