Kentico 7 - periods converted to commas when after changing language

Sean Wilke asked on November 5, 2014 17:23

I have a site in Kentico 7 which has two languages - English Canadian and French Canadian. Everything works as expected in English, but when selecting French some of the periods on the page are converted to commas (they are definitely periods in the cms).

Example: "2.5" will be converted to "2,5".

It seems to be happening with fields that with the "Decimal Number(Double Precision)" attribute type.

If I change the attribute type on the field, will I lose the existing data? What's the easiest fix here?

Recent Answers

Josef Dvorak answered on December 1, 2014 10:02

Hi Sean,

This conversion is done based on the .NET culture, Kentico does not modify the output. The quickest solution is indeed to change the field type to Text. The existing values will remain in the database.

The only other way to change this is to modify how the .NET evaluates and formats this value. However I would not recommend changing the decimal point character globally, as you would run into issues with wrong currency formatting. You can use this code directly in the transformation and change the format just for the single field:

<%# Eval<double>("<FieldName>").ToString(System.Globalization.CultureInfo.GetCultureInfo("en-CA")) %>

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.