Вот шаги и код, необходимые для создания культуры en-sg.
- Создание консольного приложения.
- Добавить ссылку на sysglobl (C: \ Windows \ Microsoft.NET \ Framework \ v2.0.50727 \ sysglobl.dll)
- Добавьте приведенный ниже код.
- Запустите его на веб-сервере (ах) и на компьютерах с правами администратора.
Это создаст культуру, основанную на том, что я нашел ее ближайшим соответствием (en-au). Затем я переопределил имена и т. Д., Чтобы сделать его уникальным.
Вы должны выполнить это только один раз. Перед созданием он удаляет все существующие на тот случай, если вы захотите внести какие-либо изменения после его запуска.
public static void Main()
{
CultureAndRegionInfoBuilder cib = null;
try
{
Console.Clear();
Console.WriteLine("Unregister the \"en-SG\" " + "custom culture if it already exists...");
CultureAndRegionInfoBuilder.Unregister("en-SG");
Console.WriteLine("The custom culture was unregistered successfully.");
}
catch (Exception e)
{
Console.WriteLine("Error while unregistering...");
Console.WriteLine(e);
}
try
{
cib = new CultureAndRegionInfoBuilder("en-SG", CultureAndRegionModifiers.None);
// Populate the new CultureAndRegionInfoBuilder object with culture information.
CultureInfo ci = new CultureInfo("en-AU");
cib.LoadDataFromCultureInfo(ci);
// Populate the new CultureAndRegionInfoBuilder object with region information.
RegionInfo ri = new RegionInfo("SG");
cib.LoadDataFromRegionInfo(ri);
cib.CultureEnglishName = "English (Singapore)";
cib.CultureNativeName = "English (Singapore)";
cib.IsMetric = true;
// Display some of the properties of the CultureAndRegionInfoBuilder object.
Console.WriteLine("CultureName:. . . . . . . . . . {0}", cib.CultureName);
Console.WriteLine("CultureEnglishName: . . . . . . {0}", cib.CultureEnglishName);
Console.WriteLine("CultureNativeName:. . . . . . . {0}", cib.CultureNativeName);
Console.WriteLine("GeoId:. . . . . . . . . . . . . {0}", cib.GeoId);
Console.WriteLine("IsMetric: . . . . . . . . . . . {0}", cib.IsMetric);
Console.WriteLine("ISOCurrencySymbol:. . . . . . . {0}", cib.ISOCurrencySymbol);
Console.WriteLine("RegionEnglishName:. . . . . . . {0}", cib.RegionEnglishName);
Console.WriteLine("RegionName: . . . . . . . . . . {0}", cib.RegionName);
Console.WriteLine("RegionNativeName: . . . . . . . {0}", cib.RegionNativeName);
Console.WriteLine("ThreeLetterISOLanguageName: . . {0}", cib.ThreeLetterISOLanguageName);
Console.WriteLine("ThreeLetterISORegionName: . . . {0}", cib.ThreeLetterISORegionName);
Console.WriteLine("ThreeLetterWindowsLanguageName: {0}", cib.ThreeLetterWindowsLanguageName);
Console.WriteLine("ThreeLetterWindowsRegionName: . {0}", cib.ThreeLetterWindowsRegionName);
Console.WriteLine("TwoLetterISOLanguageName: . . . {0}", cib.TwoLetterISOLanguageName);
Console.WriteLine("TwoLetterISORegionName: . . . . {0}", cib.TwoLetterISORegionName);
Console.WriteLine();
// Register the custom culture.
Console.WriteLine("Register the custom culture...");
cib.Register();
// Display some of the properties of the custom culture.
ci = new CultureInfo("en-SG");
Console.WriteLine("Name: . . . . . . . . . . . . . {0}", ci.Name);
Console.WriteLine("EnglishName:. . . . . . . . . . {0}", ci.EnglishName);
Console.WriteLine("NativeName: . . . . . . . . . . {0}", ci.NativeName);
Console.WriteLine("TwoLetterISOLanguageName: . . . {0}", ci.TwoLetterISOLanguageName);
Console.WriteLine("ThreeLetterISOLanguageName: . . {0}", ci.ThreeLetterISOLanguageName);
Console.WriteLine("ThreeLetterWindowsLanguageName: {0}", ci.ThreeLetterWindowsLanguageName);
}
catch (Exception e)
{
Console.WriteLine(e);
}
Console.ReadKey();
}