Locale format number in textbox

Hi,

How to locale format number in a text input? for example,123456.78 in en-US is 1,234,56.78 , in es-ES is 1.234.56,78

this is posible? or i need send format to property format:specificFormat in text for each localization?

//pseudocode

if(locale == "es-ES") specificFormat = "1.111,00";
if(locale == "en-US") specificFormat = "1,111.00";

{view:"text", format:specificFormat}

I do not think this is the best option, I hope to have explained

Thanks in advance.

Hello,

You can use webix.i18n.setLocale

var switchLocale = function(locale) {
  webix.i18n.setLocale(locale);
  $$("itext").refresh();
}

Please check https://snippet.webix.com/g1e5r4nk

Hi,

then, in calendar for example is automatic the change of culture but for numberFormat not is necesari create the variable numberformat like snippet?

var numberFormat = {
edit : function(v){ return webix.Number.format(v, webix.i18n); },
parse : function(v){ return webix.Number.parse(v, webix.i18n); }
};

Thank you very much!

By default text control doesn’t apply format at all, so you need to define one.
It can be a fixed format string or a function with number format calls.

The numberFormat block can be defined once per app, and after that reused for all controls which need number formatting.

Thanks so much!!