␡
- Uses for Custom Cultures
- Using CultureAndRegionInfoBuilder
- Installing/Registering Custom Cultures
- Uninstalling/Unregistering Custom Cultures
- Public Custom Cultures and Naming Conventions
- Supplemental Substitute Custom Cultures
- Custom Culture Locale IDs
- Custom Culture Parents and Children
- Support for Custom Cultures
- Supplemental Custom Cultures
- Culture Builder Application Sample (CultureSample)
- Combining Cultures
- Exporting Operating System-Specific Cultures
- Company-Specific Dialects
- Extending the CultureAndRegionInfoBuilder Class
- Custom Cultures and .NET Framework Language Packs
- Custom Cultures in the .NET Framework 1.1 and Visual Studio 2003
- Where Are We?
This chapter is from the book
Company-Specific Dialects
As mentioned in "Uses for Custom Cultures," at the beginning of this chapter, it can be useful to create a set of resources that use a vocabulary that is specific to a single company or group of companies. The CreateChildCultureAndRegionInfoBuilder method does just this and can be used like this:
CultureAndRegionInfoBuilder builder = CultureAndRegionInfoBuilderHelper. CreateChildCultureAndRegionInfoBuilder( new CultureInfo("en-US"), "en-US-Sirius", "English (United States) (Sirius Minor Publications)", "English (United States) (Sirius Minor Publications)", "United States (Sirius Minor Publications)", "United States (Sirius Minor Publications)"); builder.Register();
The method accepts a culture (e.g., "en-US") to inherit from, and accepts the new culture name and various strings to set various name properties to. It returns a 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; }