Hi,
On my grid, I have a column that displays a product price. I have add the .Format("C2") property for the column and it does show the value as a currency value, but I need it to be localized as en-ZA and not en-US. How do I go about changing the locale for my grid?
|
npm i cldr-data |
|
<script>
document.addEventListener('DOMContentLoaded', function () {
loadCultureFiles('en-ZA');
// The global culture required is loaded in the base
ej.base.setCulture('en-ZA');
// The global Currency code required for the culture is set
ej.base.setCurrencyCode('ZAR');
});
function loadCultureFiles(name) {
// Required culture files
var files = ['ca-gregorian.json', 'numbers.json', 'currencies.json', 'timeZoneNames.json'];
if (name === 'fr') {
files.push('numberingSystems.json');
}
var loader = ej.base.loadCldr;
var loadCulture = function (prop) {
var val, ajax;
// Culture files are loaded into the project
ajax = new ej.base.Ajax(location.origin + location.pathname + '/../../Scripts/cldr-data/main/' + name + '/' + files[prop], 'GET', false);
ajax.onSuccess = function (value) {
val = value;
loader(JSON.parse(val));
};
ajax.send();
};
for (var prop = 0; prop < files.length; prop++) {
loadCulture(prop);
}
}
</script>
|
|
document.addEventListener('DOMContentLoaded', function () {
// Localized text for the grid and pager are loaded
ej.base.L10n.load({
'en-ZA': {
"grid": {
"EmptyRecord": "Aucun enregistrement à afficher",
"True": "vrai",
.
.
},
"pager": {
.
.
}
}
});
}); |
Perfect!. It worked exactly as I wanted. Thank you so much.