X hits on this document





33 / 67


to attempt to unregister a custom culture even after rebooting the machine and still have it fail. In this case, the Unregister method simply renames the file’s extension to “tmp0” (e.g., “en-GB.tmp0”). There is no subsequent cleanup, so the temporary files remain in the Globalization folder indefinitely. This is an important point if your application registers a custom culture at startup and then unregisters as the application is shutting down. Also note that Unregister requires administrator rights.

Public Custom Cultures and Naming Conventions

The custom cultures that you create using the .NET Framework 2.0 are all public. This means that they are available to all users of all .NET Framework 2.0 applications on the machine on which they are installed.. There is no concept of a private custom culture in functional terms. Let’s consider what this means for a moment. The Reg- istry key is public, the NLP file is placed in a public location, and the culture’s name is public. This means that the cultures that you create live in the same space as the cultures that everyone else creates. We’ve seen this scenario before with DLLs, and it was often referred to as DLL Hell. Welcome to Custom Culture Hell.

The problem here is that when you create a custom culture and install it on a machine, you don’t know if someone else has already created a culture with the same name or if in the future someone will create a culture with the same name. This is especially a problem with replacement cultures, such as the one in the first example. The new en-GB culture simply modifies the short time pattern. If someone else, pos- sibly from another company, had already created an en-GB culture on the same machine, then your attempt to register your en-GB culture would fail because a cus- tom culture with that name already exists. At this point, you have two choices:

  • Don’t install your culture. Respect the original application’s en-GB culture

and hope that it doesn’t prevent your application from working properly.

  • Go ahead and overwrite the custom culture with your custom culture.

The first approach represents the very definition of optimism. The second approach will give you the kind of reputation that was given to vendors when they overwrote existing DLLs in the DLL Hell scenario. Alternatively, consider what


Document info
Document views254
Page views254
Page last viewedMon Jan 23 08:53:27 UTC 2017