define new cultures like en-FR with .NET Framework 2.0


Some global companies use English as their official language because English is the language spoken by most people at least in working environment in occidental countries. But this is not very common to obtain a response when asking what culture is the official culture. For a French global company, is it en-GB, en-US? I would say it could be en-FR, ie all vocabulary is English but metric system is used, dates are written in dd/MM/yyyy format, decimal separator is the comma (,), etc.
It is too long to have people learning French so English is used as the default language. On the other side, it is very easy for somebody to learn formatting, metric system etc (a matter of hours to getting used to it).


So en-FR could be used for our French Global company, but en-FR culture does not exist in .NET Framework. The good news is that it can be defined.


Here is a sample code that installs en-FR culture

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;

static void Main(string[] args)
{
try
{
CultureAndRegionInfoBuilder.Unregister("en-FR");
}
catch (Exception ex)
{
Console.WriteLine("could not unregister en-FR culture: {0}", ex);
}

CultureInfo templateCulture = new CultureInfo("fr-FR");
CultureAndRegionInfoBuilder cib =
new CultureAndRegionInfoBuilder("en-FR",
CultureAndRegionModifiers.None);
cib.LoadDataFromCultureInfo(new CultureInfo("en", false));
cib.LoadDataFromRegionInfo(new RegionInfo("FR"));
cib.NumberFormat = templateCulture.NumberFormat;
cib.GregorianDateTimeFormat = templateCulture.DateTimeFormat;
cib.Register();

Console.WriteLine("OK");
Console.ReadLine();
}

Skip to main content