X hits on this document

245 views

0 shares

0 downloads

0 comments

56 / 67

32

.NET INTERNATIONALIZATION

Click OK to save your custom culture. CultureBuilderSample can also be used to combine cultures and to create replacement cultures.

Combining Cultures

One of the common reasons for wanting to create a custom culture is to create a com- bination of language and region in which the language and the region are known but have not yet been paired. The benefit of creating such a combined culture is that you can refer to a language and region that is important to your target market but that is not defined in the .NET Framework or operating system. Table 11.1 shows some example combinations, with “es-US(Spanish (United States) being one of the most requested. The CultureAndRegionInfoBuilderHelper class (included with the source code for this book) performs the drudgery of combining two cultures and can be used like this:

CultureAndRegionInfoBuilder builder = CultureAndRegionInfoBuilderHelper. CreateCultureAndRegionInfoBuilder( new CultureInfo(“es-ES”), new RegionInfo(“en-US”));

builder.Register();

The CultureAndRegionInfoBuilderHelper.CreateCultureAndRegionIn- foBuilder method creates a new CultureAndRegionInfoBuilder from a “lan- guage” CultureInfo (“es-ES”) and a “region” RegionInfo (“en-US”). The new object is then used either to Register the culture or to Save the culture. The Create- CultureAndRegionInfoBuilder has various overloads to accept variations on the same theme.

The process of “splicing together” two cultures is not as straightforward as you might think. Table 11.6 shows the CultureAndRegionInfoBuilder properties, and the source of their values and their actual values using the Spanish (United States) example.

Document info
Document views245
Page views245
Page last viewedSun Jan 22 10:07:43 UTC 2017
Pages67
Paragraphs859
Words13458

Comments