WPF Localization

In WPF the localization process is also based on resources but with different steps. Also, there are some alternative techniques for accomplishing localization but we cover the most common.

Note on Installed Culture

Code examples shown in this section assume that your system’s regional settings are based on the en-US (English-United States) culture. If your system is based on different regional settings, replace en-US with the culture information that suits your system.

When you compile a WPF project, the XAML code is parsed into a more efficient file format known as BAML (Binary Application Markup Language). Generally each Baml file represents a resource that is then linked into the executable storing all resources. To localize a WPF application you need to localize Baml objects and put the result into a satellite assembly. This is accomplished using a command-line tool named LocBaml.exe, which is available for free from the MSDN. It is distributed as C# source code so you need to open it inside Visual Studio and compile it. At the moment this chapter is being written, LocBaml source code is available for .NET Framework versions prior than 4.0 so in order to make it work with next examples you need to perform some steps that are described in the next subsection.

LocBaml for .NET 4.0

You can check for the availability of a new version of LocBaml targeting .NET 4.0 at the following address: http://msdn.microsoft.com/en-us/library/ms771568(VS.100).aspx. When Microsoft makes it available, you can skip the next section and go to the “Localizing a WPF Application” section.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.143.9.223