#1,115 – Internationalization I – Obey CurrentCulture for Output

The first step in internationalizing an application is to ensure that your application honors the user’s current regional settings, as reflected by the CurrentCulture property of the application’s main thread.

Current culture impacts the display of the following:

  • Numeric data
  • Date/time values
  • Currency values

All of these values are typically stored internally as numeric (e.g. double, int) or DateTime values.  These values exist in memory in a culture-agnostic form.  You only need to worry about regional settings when you display a value to the user.

In .NET, if you use the ToString method on a numeric or date/time object, with or without formatting strings, the resulting string will correctly reflect the current regional settings.

If you’re using data binding to convert numeric or date/time data to strings, you need to manually set the Language property on each window or page to force data binding to use the culture correctly.

About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

2 Responses to #1,115 – Internationalization I – Obey CurrentCulture for Output

  1. Pingback: Dew Drop – July 16, 2014 (#1815) | Morning Dew

  2. Pingback: #1,116 – An Example of Output that Obeys CurrentCulture | 2,000 Things You Should Know About WPF

Leave a comment