X hits on this document

260 views

0 shares

0 downloads

0 comments

64 / 67

40

.NET INTERNATIONALIZATION

CultureAndRegionInfoBuilder object that can be used to register the culture. The CreateChildCultureAndRegionInfoBuilder method follows:

public static CultureAndRegionInfoBuilder CreateChildCultureAndRegionInfoBuilder( CultureInfo parentCultureInfo, string cultureName, string cultureEnglishName, string cultureNativeName, string regionEnglishName, string regionNativeName)

{

RegionInfo parentRegionInfo = new RegionInfo(parentCultureInfo.Name);

CultureAndRegionInfoBuilder builder = new CultureAndRegionInfoBuilder(cultureName, CultureAndRegionModifiers.None);

// load the culture and region data from the parent builder.LoadDataFromCultureInfo(parentCultureInfo); builder.LoadDataFromRegionInfo(parentRegionInfo);

builder.Parent = parentCultureInfo; builder.CultureEnglishName = cultureEnglishName; builder.CultureNativeName = cultureNativeName; builder.RegionEnglishName = regionEnglishName; builder.RegionNativeName = regionNativeName;

return builder;

}

Extending the CultureAndRegionInfoBuilder Class

In the “Extending the CultureInfo Class” section of Chapter 6, I showed a CultureInfoEx class that extends the .NET Framework’s CultureInfo class. This CultureInfoEx can be used to hold additional information about a culture; the example given added postal code format information that can be used as a mask for data entry. If you like the idea of custom cultures and you also like the idea of extend- ing the CultureInfo class, then the natural extension is to put both together and have extended custom cultures. Unfortunately, the custom culture architecture is a closed architecture, and this scenario is not supported. A number of barriers prevent the custom culture architecture from being extended:

Document info
Document views260
Page views260
Page last viewedTue Jan 24 03:36:07 UTC 2017
Pages67
Paragraphs859
Words13458

Comments