If you are planning to publish your application worldwide, you may need to prepare different versions of the user interface for different regions. At the very least, this needs to be addressed by translating the text into the appropriate language, as well as resolving the problem of UI changes. You may need a specific look adapted for localized cultural practices. Alternatively, you may find that the original appearance does not work correctly after the translation, because the length of the word is not the same. (although WPF's façade system avoids this problem, it's easier to create a more resilient look.) )
It is possible to create different versions of your software in different markets. However, it is more common to create a separate version that adapts to different locations by selecting an appropriate resource file during the run time. The underlying architecture of WPF ResourceManager can use this approach fairly directly.
Microsoft distinguishes between localization and globalization. Localization is the process of supporting an application to care about the use of a particular locale by creating a culture-specific resource such as text translation. Globalization is a process that ensures that an application can be localized without compiling. Using ResourceManager can help us globalize our applications, because the resources selected for this class during runtime support a separate version of the application by providing the right resources for localization. For more information please refer to Microsoft International site http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/ Vboriinternationalization.asp (HTTP://SHRINKSTER.COM/6M9).
When a ResourceManager is asked to obtain a resource stream by name, it first decides which culture to use. The culture of the language and the region collectively, is typically represented as a short string. For example, en-US represents English for use in the United States. EN-GB, however, represents English used in the UK. The first two letters indicate the language, and the last two represent regions. The language and region are also identified because even though the two cultures share one language, there are differences in dialect and idioms. For example, one of the authors of this book comes from EN-GB and prefers to use color rather than colour.
The ResourceManager GetStream method uses a CultureInfo object as an argument. If you want to use the culture that the user finally configured, you can retrieve a CultureInfo object from the Thread.CurrentThread currentuiculture attribute.
Although the executable often compiles resources into it, ResourceManager will still first look for the resources of the specified culture before being asked to embed resources. The first is to search by culture name in the subdirectory that contains the application directory. Therefore, if your application is running on French-Canadian culture, look for a file called MyApp.resources.dll in the subdirectory named Fr-ca, where MyApp is the name of the application or component. If it does not exist, it will then look for the same file in the directory named Fr. This means that once your translation budget is not extended to produce a different version for all the different regions of the world that use French, you can replace it by providing a separate set of French resources dedicated to the area used in French. If none of these subdirectories exist, it will resort to using embedded resources.
The DLL resources sought by ResourceManager are called globalized compilation resources because they are small resources that are clustered into a large compilation set.
Note that once you provide a globalized compilation, you do not need to provide localized versions of all resources. So the resources that are embedded in your master compilation set are very good for all the resources. For example, the application in Figure 6-6 has an embedded BMP file sunset.jpg. Most of the world will have sunsets, so you may still need to do special work for the Antarctic and Arctic versions. The basic sunset.jpg can be used for most cultures. This is going to be a waste of space. Get a copy of the same picture for each globalized resource. Fortunately, this is not necessary. If a particular named resource does not exist in the globalized compilation resource, ResourceManager will return to the embedded resource.
You can imagine the globalization compilation resources as the difference between the resources needed to contain only the embedded resources and the target culture. Any common resources are located separately in the primary compilation set. A subdirectory, such as the FR subdirectory, that contains a specific language but an open-ended compilation set containing the required resources that are different from a specific language. Furthermore, a completely culturally specific subdirectory (such as fr-ca,fr-fr,fr-be, etc.) contains resources that need to consider local idioms (in this context, "resource" is a stream that has been ResourceManager through the Instead of the object retrieved by ResourceDictionary)