X hits on this document

184 views

0 shares

0 downloads

0 comments

29 / 67

CUSTOM CULTURES

Win32 data, so this value cannot be set in the Regional and Language Options dia- log. The following code creates a replacement custom culture and registers it:

// create a CultureAndRegionInfoBuilder for a // replacement for the en-GB culture CultureAndRegionInfoBuilder builder =

new CultureAndRegionInfoBuilder(“en-GB”, CultureAndRegionModifiers.Replacement);

// the en-GB’s short time format builder.GregorianDateTimeFormat.ShortTimePattern = “HH:mm tt”;

// register the custom culture builder.Register();

The CultureAndRegionInfoBuilder constructor accepts two parameters: the custom culture name and an enumeration identifying what kind of custom culture the new culture is. The replacement culture is registered using the Register method. Once registered, all .NET Framework 2.0 applications on this machine will use the modified en-GB culture instead of the original, without any change to those applications.

Installing/Registering Custom Cultures

The CultureAndRegionInfoBuilder Register method performs two actions:

  • Creates an NLP file in the system’s Globalization folder

  • Adds an entry to the Registry in HKEY_LOCAL_MACHINE\System\

CurrentControlSet\Control\Nls\IetfLanguage

The NLP file is a binary representation of the custom culture. No API exists for this file format, so you must treat it like a black box. The file is placed in %WINDIR%\Globalization and given the same name as the custom culture—e.g., c:\Windows\Globalization\en-GB.NLP.

The Registry entry provides the IetfLanguage name for the custom culture for static CultureInfo methods. The key is the custom culture’s IetfLanguage, and the value is the semicolon-separated list of custom culture names that share the same

5

Document info
Document views184
Page views184
Page last viewedFri Dec 09 13:50:16 UTC 2016
Pages67
Paragraphs859
Words13458

Comments