Click here to Skip to main content
12,549,492 members (45,504 online)
Click here to Skip to main content
Add your own
alternative version


20 bookmarked

Culture and Region Information Tool for .NET 2.0

, 29 Jan 2007 CPOL
Rate this:
Please Sign up or sign in to vote.
A Culture and Region Information tool for .NET 2.0 based on System.Globalization.CultureAndRegionInfoBuilder


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

The tool is just a simple command line parser that calls methods of the CultureAndRegionInfoBuilder class.

Extracting Culture and Region Information

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)
    CultureAndRegionInfoBuilder cultureAndRegionInfoBuilder
        = new CultureAndRegionInfoBuilder
        (cultureName, CultureAndRegionModifiers.Replacement);

Registering Culture and Region Information

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 =

Unregistering Culture and Region Information

For unregistering culture and region information, the Unregister method of CultureAndRegionInfoBuilder is called for the specified culture.

private static void UnregisterCustomCulture(string cultureName)


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Paulo Morgado
Software Developer (Senior) Paulo Morgado
Portugal Portugal

You may also be interested in...


Comments and Discussions

QuestionHelp Pin
MarkRedman29-Jan-07 5:30
memberMarkRedman29-Jan-07 5:30 
AnswerRe: Help Pin
M.Lansdaal29-Jan-07 10:14
memberM.Lansdaal29-Jan-07 10:14 
AnswerRe: Help Pin
Paulo Morgado29-Jan-07 11:59
memberPaulo Morgado29-Jan-07 11:59 
AnswerRe: Help Pin
MarkRedman29-Jan-07 12:47
memberMarkRedman29-Jan-07 12:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.161021.1 | Last Updated 29 Jan 2007
Article Copyright 2007 by Paulo Morgado
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid