#1,117 – Internationalization II – Obey CurrentCulture for Input
July 18, 2014 Leave a comment
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 not only how you display the following types of data, but also how the user inputs this data:
- Numeric data
- Date/time values
These values are typically stored internally as numeric (e.g. double, int) or DateTime values. The values exist in memory in a culture-agnostic form. You need to worry about regional settings only when you display a value to the user or receive input from the user.
In .NET, if you use the Parse method of a numeric or date/time type to convert a user-supplied string to the internal type, the parse operation will expect the string to be in a format that is valid for the current region.