This is a migrated thread and some comments may be shown as answers.

Overriding culture decimal separator

3 Answers 675 Views
Globalization
This is a migrated thread and some comments may be shown as answers.
Manoela
Top achievements
Rank 1
Manoela asked on 30 Mar 2020, 07:56 AM

Hello there,
 We have a customer who wants to override decimal sepataor in a specific culture. We have tried to override it before any widget is initialized. Also created our custom culture file and used it but the result is the same. kendo.culture().numberFormat["."] show the sybol we want, but in the UI is still the default symbol. Here is a dojo showing that only curency symbol is being overwritten.

 https://dojo.telerik.com/USUkomuY/5

 

 

3 Answers, 1 is accepted

Sort by
0
Nencho
Telerik team
answered on 01 Apr 2020, 07:44 AM

Hello, Monoela,

I would suggest revising the following documentation article, where it is demonstrated in details on how to apply the needed changes:

https://docs.telerik.com/kendo-ui/globalization/intl/definecultureinfo#extending-culture-information

Also, in the context of the Grid, you would need to set the column format, in order to achieve the needed rendering:

 { field: "UnitsInStock", title: "Units In Stock", width: "130px", format: "{0:n}" },

Here's the modified dojo on the matter:
 https://dojo.telerik.com/USUkomuY/30

Regards,
Nencho
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Manoela
Top achievements
Rank 1
answered on 01 Apr 2020, 08:51 AM

Hello Nencho,

I dont t'hink you trully understand me. I want to change the default decimal separator. In the dojo you have provided me the decimal separator of UnitsInStock is still dot("."). 

I will try to explain again. The default decimal separator in my culture("bg-BG") is comma(","). My customer wants to change it to dot(".") in the entire app. I have provided you a dojo where the culture is ("en-US") where default comma separator is dot(".") and I have tried to change it to caret("^") just for visual clearance. My problem is that it changes only for currency but not for other number formats.

 

Greetings,

Manoela

Mapex JSC

0
Dimitar
Telerik team
answered on 03 Apr 2020, 08:02 AM

Hello Manoela,

Please refer to the following updated Dojo example. In it, the currency, percentage and number formats of the En-US culture are customized as follows:

var customUS = $.extend(true, {}, kendo.culture(), {
  name: "custom-US",
  numberFormat: {
    ",": " ",
    ".": "^",
    currency: {
      ",": " ",
      ".": "^",
    },
    percent: {
      ",": " ",
      ".": "^",
    }
  }
});

kendo.cultures["custom-US"] = customUS;

kendo.culture("custom-US");

With the above setup, the UnitsInStock and UnitPrice have a format set respectively to number({0:n}) and currency({0:c}) and both values displayed in the Grid are formatted according to the set culture values. For additional information on Number formatting you could refer to the Number Formatting Documentation article.

Also, the Kendo UI widgets that support date and number formatting are listed here:

In case you would like to format a string to date or number using the currently set culture, you could utilize the kendo.toString(), kendo.format() and kendo.parseDate() methods as described here:

In case you have any additional questions on the above, please let me know.

Regards,
Dimitar
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
Globalization
Asked by
Manoela
Top achievements
Rank 1
Answers by
Nencho
Telerik team
Manoela
Top achievements
Rank 1
Dimitar
Telerik team
Share this question
or