Tag Archives: internationalization

Display locale-aware sample dates and currency values in C#

This program uses the following simple CultureData class to store information about a locale. // A class to store cultre data. public class CultureData { // The CultureInfo. public CultureInfo Info; // Initializing constructor. public CultureData(CultureInfo info) { Info = … Continue reading

Posted in internationalization, localization | Tagged , , , , , , , , , , , , , , , | Leave a comment

Make locale-aware methods use a new culture at runtime in C#

The example Change program locale at runtime in C# explains how to change a program’s locale and reload its controls for the new locale. However, that doesn’t change the thread’s current culture, which determines the formats used by locale-aware methods … Continue reading

Posted in internationalization, localization | Tagged , , , , , , , , , , , , , , , | Leave a comment

Make a stopwatch in C#

This program is a simple stopwatch. When you click the Start button, the program changes the button’s caption to Stop and starts a Timer. As the stopwatch Timer runs, the program displays the elapsed time. Click the Stop button to … Continue reading

Posted in internationalization, miscellany, strings | Tagged , , , , , , , , , , , , , | Leave a comment

Print a calendar in C#

This example prints a calendar containing some text for each day. It’s mostly a matter of keeping track of where to draw things, but it also requires you to handle some confusing internationalization issues and there’s one potential gotcha. The … Continue reading

Posted in internationalization, system | Tagged , , , , , , , , , , , , , , | Leave a comment

Get the name of the first day of the week in C#

Different cultures start the week with a different first day of the week. For example, some cultures start the week with Monday and others start it with Sunday. Usually it doesn’t matter which day is the first day of the … Continue reading

Posted in internationalization, system | Tagged , , , , , , , , , , , , , | 1 Comment

Display the local time and GMT in C#

This example uses a Timer to execute the following code every half second. // Update the clocks. private void tmrClock_Tick(object sender, EventArgs e) { // Display the local time. DateTime now = DateTime.Now; lblLocalTime.Text = now.ToLongTimeString(); lblLocalDate.Text = now.ToShortDateString(); // … Continue reading

Posted in internationalization, system | Tagged , , , , , , , , , , , , , , | 1 Comment

Get date format information for the computer’s locale in C#

The System.Globalization namespace’s InstalledUICulture object provides lots of static methods giving information about numeric, date, and time formatting for the computer’s locale. This example adds a bunch of these values to a ListView control. The following code shows how the … Continue reading

Posted in internationalization, system | Tagged , , , , , , , , , , , , , , , , , | Leave a comment

Display sample formats for different locales in C#

This example loops through the system’s defined locales and displays sample numbers, currency values, dates, and times in each. When the program starts, the following code executes. private void Form1_Load(object sender, EventArgs e) { float float_value = 1234.56f; decimal dec_value … Continue reading

Posted in internationalization, localization | Tagged , , , , , , , , , , | Leave a comment

Change program locale at runtime in C#

This example lets you change program locale at runtime so you can test localized programs. The example Test localized programs in C# explains how you can make a program select a specific locale when it starts so you can test … Continue reading

Posted in globalization, internationalization, localization | Tagged , , , , , , , , , , , , , , , , , | 1 Comment

Test localized programs in C#

The example Localize a program in C# explains how you can localize a program so it displays different user interfaces depending on the system’s locale. After you localize it, the program automatically selects the correct locale at runtime. Because it … Continue reading

Posted in globalization, internationalization, localization | Tagged , , , , , , , , , , , , , | 1 Comment