X hits on this document

186 views

0 shares

0 downloads

0 comments

59 / 67

CUSTOM CULTURES

The new culture is a combination of the language and the region, but many of the names used in the culture need to be localized. Whereas the new culture uses the calendar for the region, the names of the days and months of that calendar must be in the specified language (i.e., Spanish), and not the language from which the calen- dar has come (i.e., English). The LoadDataFromRegionInfo method is very helpful in this scenario, but the LoadDataFromCultureInfo is less so. The CultureAndRe- gionInfoBuilderHelper.CreateCultureAndRegionInfoBuilder method is shown here:

public static CultureAndRegionInfoBuilder CreateCultureAndRegionInfoBuilder( CultureInfo languageCultureInfo, RegionInfo regionInfo, string cultureName)

{

if (cultureName == null || cultureName == String.Empty) // the culture name is blank so construct a default name cultureName = l a n g u a g e C u l t u r e I n f o . T w o L e t t e r I S O L a n g u a g e N a m e + - regionInfo.TwoLetterISORegionName; +

CultureInfo languageNeutralCultureInfo = GetNeutralCulture(languageCultureInfo);

CultureInfo regionCultureInfo = new CultureInfo(regionInfo.Name);

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

builder.LoadDataFromCultureInfo(regionCultureInfo); builder.LoadDataFromRegionInfo(regionInfo);

builder.Parent = languageNeutralCultureInfo;

builder.CompareInfo = languageCultureInfo.CompareInfo; builder.TextInfo = languageCultureInfo.TextInfo;

builder.IetfLanguageTag = cultureName;

builder.RegionNativeName = GetNativeRegionName( regionInfo, languageCultureInfo);

builder.CultureEnglishName =

35

Document info
Document views186
Page views186
Page last viewedSat Dec 10 06:56:05 UTC 2016
Pages67
Paragraphs859
Words13458

Comments