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

Localization Issue

2 Answers 41 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Nikolaj
Top achievements
Rank 1
Nikolaj asked on 17 Aug 2011, 09:53 PM
It seems you're using the local decimal denoter when writing floats and doubles. Take this example, in a Danish locale:
Vector2 vector2 = new Vector2((float)rectangle.Width * 0,5, (float)rectangle.Height * 0,5);

Notice the two decimal numbers use comma instead of period. Comma is the standard in Denmark, but it means the produced code is useless.

EDIT:
Actually, it seems to only happen in some cases.

2 Answers, 1 is accepted

Sort by
0
Nikolaj
Top achievements
Rank 1
answered on 20 Aug 2011, 04:20 PM
Quick reproduction instructions

static void Main(string[] args)
{
    Console.WriteLine(0.30f);
    Console.WriteLine(0.30);
    Console.ReadKey(true);
}

Is decompiled into this

private static void Main(string[] args)
{
    Console.WriteLine(0,3);
    Console.WriteLine(0.30);
    Console.ReadKey(true);
}

Here's my localization settings: clicky

It's obviously an issue with float/Single, as without the "f" suffix, it doesn't happen.
0
Kaloyan
Telerik team
answered on 23 Aug 2011, 09:09 AM
Hi Nikolaj,

Thank you for reporting the issue. I am starting with the investigation of the localization problem. A fix will be provided in the next product update.

Greetings,
Kaloyan
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Tags
General Discussions
Asked by
Nikolaj
Top achievements
Rank 1
Answers by
Nikolaj
Top achievements
Rank 1
Kaloyan
Telerik team
Share this question
or