0

I'm going tell to my WinForms application to use CultureInfo native numbers instead of system numbers (e.g. English version) to show numeric/digits. So is there any approach to do this?

Thread.CurrentThread.CurrentCulture = new CultureInfo("fa-IR");
Thread.CurrentThread.CurrentUICulture = new CultureInfo("fa-IR");

Thanks a lot ;)

Sadegh
  • 4,181
  • 9
  • 45
  • 78

2 Answers2

1

Yes you are in right direction

// it will tell to use french
CultureInfo frenchCulture = new CultureInfo("fr-FR");
Thread.CurrentThread.CurrentCulture = frenchCulture;

For more information visit Formatting Numeric Data for a Specific Culture

Waqas Raja
  • 10,802
  • 4
  • 33
  • 38
1

this could be ok if you do it once for the whole application, not in every single method, but in fact, why don't you leave the framework to do what it needs to do, what if the user has set to use German language? you should respect what the user wants and what he has set in the windows control panel.

Davide Piras
  • 43,984
  • 10
  • 98
  • 147
  • I sometimes offer the user to switch manually. You also could argue "why does YouTube provide a large language switching menu at the bottom of their site". Most likely this is an addition since there _may_ be situations where the automatic detection is not 100% accurate (Imagine a German user sitting on a French Windows who wants to work in German but has no permissions to switch the whole OS language). – Uwe Keim Feb 04 '11 at 20:42
  • Yes I know culture should specified on application whole. My application in only work with culture far-IR, but numbers aren't shown with correct chars for example 5 should be ۵ – Sadegh Feb 04 '11 at 20:52
  • When i convert English digits to appropriate character in Persian, i haven't ComboBox typing feature for routing to correct item for example. – Sadegh Feb 04 '11 at 20:55