X hits on this document

190 views

0 shares

0 downloads

0 comments

32 / 67

8

.NET INTERNATIONALIZATION

builder.Register();

Console.WriteLine( “{0} custom culture registered”, customCultureFile);

}

} Console.WriteLine(“”); Console.WriteLine(“Registration complete.”);

}

The RegisterCustomCulture application simply iterates through each of the command-line parameters. If the parameter starts with “/u:”, it attempts to unreg- ister an existing custom culture; otherwise, it attempts to load the parameters as LDML files and then register them.

It is worth noting, however, that as the Register method writes to the Registry and to the system’s Globalization folder, any code that uses it requires adminis- trator rights to execute. This means that if you intend to deploy applications that use custom cultures, the application that creates the custom cultures (e.g., Register- CustomCulture.exe) must obviously have administrator rights (no additional rights are required to simply create CultureInfo objects from custom cultures, however). If you deploy your Windows Forms applications using ClickOnce, you should cre- ate your custom cultures using the ClickOnce Bootstrapper because the ClickOnce application itself will not be granted administrator rights.

Uninstalling/Unregistering Custom Cultures

Custom cultures can be unregistered using the static CultureAndRegionIn- foBuilder.Unregister method:

CultureAndRegionInfoBuilder.Unregister(“en-GB”);

This method attempts to undo the two steps of the Register method (it deletes the Registry key and attempts to delete the NLP file). The attempt to delete the NLP file might or might not be successful. The Unregister method looks to see if the cus- tom culture is referenced by other custom cultures. In the process of doing so, it can open the NLP file itself and be the cause of its own failure. This is why it is possible

Document info
Document views190
Page views190
Page last viewedSat Dec 10 15:36:43 UTC 2016
Pages67
Paragraphs859
Words13458

Comments