This example shows you How to use CultureInfo in C# to help you create applications that support multiple languages.
How to CultureInfo in C#
The CultureInfo class helps you create your application that supports multiple languages. It belongs to the System.Globalization namespace.
To get current culture name you can use the following c# code.
var name = Thread.CurrentThread.CurrentCulture.Name;
and don't forget to include the namespace below at the top.
using System.Threading;
You can create the culture for your application as the following c# code.
static void InitCulture()
{
CultureInfo cul = new CultureInfo(("en-US"));
cul.NumberFormat.CurrencyDecimalSeparator = ".";
cul.NumberFormat.CurrencyGroupSeparator = ",";
cul.NumberFormat.NumberDecimalSeparator = ".";
cul.NumberFormat.NumberGroupSeparator = ",";
cul.NumberFormat.PercentDecimalSeparator = ".";
cul.NumberFormat.PercentGroupSeparator = ",";
cul.DateTimeFormat.ShortDatePattern = "dd/MM/yyyy";
Application.CurrentCulture = cul;
}
then call the InitCulture method in the main thread
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
InitCulture();
Application.Run(new frmMainFluentDesign());
}