X hits on this document

172 views

0 shares

0 downloads

0 comments

45 / 67

CUSTOM CULTURES

Support for Custom Cultures

Custom cultures are supported not only in the .NET Framework 2.0, but also in Microsoft’s .NET Framework 2.0 development tools. The .NET Framework 2.0 enables you to get a list of custom cultures using CultureInfo.GetCultures:

foreach (CultureInfo cultureInfo in CultureInfo.GetCultures(CultureTypes.UserCustomCulture))

{

listBox1.Items.Add( cultureInfo.Name + “ (“ + cultureInfo.DisplayName + “)”);

}

The CultureTypes value is UserCustomCulture. You can test a culture to see if it is a custom culture using its CultureTypes property:

CultureInfo cultureInfo = new CultureInfo(“en-GB”); if ((CultureTypes.UserCustomCulture & cultureInfo.CultureTypes)

!= (CultureTypes)0) Text = “User Custom Culture”;

else Text = “Not User Custom Culture”;

The Visual Studio 2005 Form Designer also supports custom cultures. When you localize a form by setting Form.Localizable to true, the Form.Language combo box includes custom cultures.

Note

The combo box is filled using CultureInfo.DisplayName. Recall that, for supplemental custom cultures, CultureInfo.Display- Name is always CultureInfo.NativeName, not CultureInfo.EnglishName, so your custom culture might not be where you expect it in the sorted list.

As with Visual Studio 2005, WinRes, the Windows Resource Localization Editor, supports custom cultures and allows forms resources for custom cultures to be opened and saved.

21

Document info
Document views172
Page views172
Page last viewedThu Dec 08 05:00:17 UTC 2016
Pages67
Paragraphs859
Words13458

Comments