DataTable provides support for localizing numbers, currencies, and dates.
The standard package of the Webix library includes 9 locales:
Webix Pro edition includes over 300 locales.
To localize your app into some other language, do the following:
Locale is created in a separate js file named as "ll-CC", where:
Creating Spanish (Spain) locale for DataTable. The 'es-ES.js' file
webix.i18n.locales["es-ES"]={ // "es-ES" - the locale name, the same as the file name
groupDelimiter:" ", // a mark that divides numbers with many digits into groups
groupSize:3, // the number of digits in a group
decimalDelimiter:",", // the decimal delimiter
decimalSize:2, // the number of digits after the decimal mark
// applied to columns with 'format:webix.i18n.dateFormatStr'
dateFormat:"%d/%m/%Y",
// applied to columns with 'format:webix.i18n.dateFormatStr'
timeFormat:"%H:%i",
// applied to columns with 'format:webix.i18n.longDateFormatStr'
longDateFormat:"%d %F %Y",
// applied to cols with 'format:webix.i18n.fullDateFormatStr'
fullDateFormat:"%d.%m.%Y %H:%i",
// EUR-currency name.Applied to cols with 'format:webix.i18n.priceFormat'
price:"{obj} EUR",
calendar:{
monthFull:["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio",
"Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"],
monthShort:["En", "Feb", "Mar", "Abr", "Mayo", "Jun",
"Jul", "Ago", "Sep", "Oct", "Nov", "Dic"],
dayFull:["Domingo", "Lunes", "Martes", "Miercoles", "Jueves", "Viernes", "Sabado"],
dayShort:["Dom", "Lun", "Mar", "Mier", "Jue", "Vier", "Sab"]
}
};
To activate a locale:
<script src="../locale/es-ES.js" type="text/javascript" charset="utf-8"></script>
<script> webix.i18n.setLocale("es-ES");
grid = webix.ui({
view:"datatable",
columns:[
{ header:"Date", id:"start", format:webix.i18n.dateFormatStr},
{ header:"LongDate",width:170, id:"start",format:webix.i18n.longDateFormatStr},
{ header:"Price", id:"number", format:webix.i18n.priceFormat },
],
...
});
</script>
Related sample: DataTable Localization
Back to top