Skip to main content

Creating a Custom Culture using .NET



Namespace: System.Globalization

CultureAndRegionInfoBuilder class provides the facility to create new and customize existing cultures.

To install a custom culture one must have administrative privileges. One must Add Reference of sysglobal.dll in order to create objects of CultureAndRegionInfoBuilder.

CultureAndRegionInfoBuilder vCulture = new CultureAndRegionInfoBuilder(“en-US”, CultureAndRegionModifiers.Neutral);

OR

CultureInfo vCultureInfo = new CultureInfo(“en-US”);
RegionInfo vRegionInfo = new RegionInfo(“US”);

CultureAndRegionInfoBuilder vNewCulture = new CultureAndREgionInfoBuilder( “en-MS”, CultureAndRegionModifiers.Neutral);

vNewCulture.Load(vCultureInfo);
vNewCulture.Load(vRegionInfo);


CultureAndRegionModifiers Enumeration:
Class
Description
Neutral
A neutral custom culture.
None
A specific, supplemental custom culture.
Replacement
A custom culture that replaces an existing .NET Framework culture or Windows Locale.

To create a culture from scratch one must go for CultureAndRegionModifiers.Replacment.

And one must only use the CultureAndRegionInfoBuilder only when the culture intended to be created does not already exists.

Comments

Popular posts from this blog

Culture Information and Localization in .NET

Namespace: System.Globalization CultureInfo Class:                 It provides information like the Format of numbers and dates, Culture’s Calendar, Culture’s language and sublanguage (if applicable), Country and region of the culture. The Basic use of CultureInfo class is shown here: • How string Comparisons are performed • How Number Comparison & Formats are performed • Date Comparison and Formats. • How resources are retrieved and used. Cultures are grouped into three categories: Invariant Culture : It’s Culture Insensitive. It can be used to build some trial application. It can be also used to build an application with hard-coded expiry date that ignores cultures. But using it for every comparison will be incorrect and inappropriate. Neutral Culture : English(en), Frensh(fr), and Spanish(sp). A neutral culture is related to language but it’s not related to specific regi...

Data Serialization in .Net

Namespace: System.Runtime.Serialization Serialization is the process of converting object so that they can be transmitted over the network, or stored in file for later use, or passing them to a web service or any other application. .Net WebServices, Session Object, .Net Remoting and clipboard rely on Serialization. Binary Serialization: It’s efficient but not portable solution. String data = “Hello”; FileStream fs = new FileStream(“FileStream.Data”, FileMode.Create); BinaryFormatter bf = new BinarFormatter (); Bf.Serilize(fs, data); //Wrting Objects Bf.Serilize(fs,System.DateTime.Now); Fs.close(); Deserializing Objects FileStream fs = new FileStream(“FileStream.Data”, FileMode.Open); BinaryFormatter bf = new BinarFormatter (); String Data = (String)bf.Deserialize(fs); DateTime vTime = (DateTime) bf.Derialize(fs); To serialize a class one must the Serializeable attribute to that class. To omit some attribute from deseriali...

Using ADO.NET Transaction Object, Saving CLR Objects and SqlNotificationRequest

Serializable allows one transaction to complete before the other start. SqlConnectoin support named savpoint to roll back to; that’s an equaliant to save transaction command in MS SQL Server. Using TransactionScope Object : A transaction can’t span multiple connections.   Local and distributed transaction ares supported in 1.x you have to Enterpeise seveices library to regiser multiple connections and then call EnlistDistributedTransaction. Distributed Transaction Coordinator is required for Distributed transaction that’s available on windows 2000 & +. In 2.X and later use TransactionScope object. Serializable allows one transaction to complete before the other start. SqlConnectoin support named savpoint to roll back to; that’s an equaliant to save transaction command in MS SQL Server. Using TransactionScope Object : Dispoase of the transaction must be called to complete the transaction. Distributed Transaction : ...