![]() |
Platforms, Frameworks & Libraries »
.NET Framework »
Utilities
Advanced
License: The Code Project Open License (CPOL)
Culture and Region Information Tool for .NET 2.0By Paulo MorgadoA Culture and Region Information tool for .NET 2.0 based on System.Globalization.CultureAndRegionInfoBuilder |
C# 2.0, Windows, .NET 3.0, ASP.NET, VS2005, Architect, Dev
|
|
Advanced Search Add to IE Search |
|
|
|
||||||||||||||||
Defining custom culture and region information is common practice in many enterprise environments.
In the .NET Framework 2.0, we can use the CultureAndRegionInfoBuilder class to build a custom culture that is new or based on an existing culture and region. The custom culture can be installed on a computer and subsequently used by any application running on that computer.
Using this class, I've built a small command line tool to extract, register and unregister culture and region information.
The tool is just a simple command line parser that calls methods of the CultureAndRegionInfoBuilder class.
For extracting culture and region information, an instance of CultureAndRegionInfoBuilder is created for the specified culture with the Replacement modifier and saved to the specified file.
private static void ExtractCultureAndRegionInfo(string cultureName, string filenName)
{
FileInfo fileInfo = GetFileInfo(filenName);
if (fileInfo.Exists)
{
fileInfo.Delete();
}
CultureAndRegionInfoBuilder cultureAndRegionInfoBuilder
= new CultureAndRegionInfoBuilder
(cultureName, CultureAndRegionModifiers.Replacement);
cultureAndRegionInfoBuilder.Save(fileInfo.FullName);
}
For registering culture and region information, an instance of CultureAndRegionInfoBuilder is created from the specified LDML definition file and registered.
private static void RegisterCustomCulture(string filenName)
{
FileInfo fileInfo = GetFileInfo(filenName);
CultureAndRegionInfoBuilder cultureAndRegionInfoBuilder =
CultureAndRegionInfoBuilder.CreateFromLdml(fileInfo.FullName);
cultureAndRegionInfoBuilder.Register();
}
For unregistering culture and region information, the Unregister method of CultureAndRegionInfoBuilder is called for the specified culture.
private static void UnregisterCustomCulture(string cultureName)
{
CultureAndRegionInfoBuilder.Unregister(cultureName);
}
| You must Sign In to use this message board. | |||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||
General
News
Question
Answer
Joke
Rant
Admin
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 29 Jan 2007 Editor: Deeksha Shenoy |
Copyright 2007 by Paulo Morgado Everything else Copyright © CodeProject, 1999-2009 Web12 | Advertise on the Code Project |