Supporting multiple languages – localization
To accommodate multiple languages, we can utilize the .NET built-in mechanism for localizing applications. In .NET, resources files can be used to support localization by consolidating all text and other resources required for an application’s user interface in one location. In a XAML file, we can use the x:Static
markup extension to access the string defined in resources files.
Creating a .resx file
We can generate a resources file for each supported language. Resources files are XML files with a .resx
extension, which are compiled into binary resources files during the build process. To add a resources file, right-click the project node and select Add > New Item... > Resources File, as shown in Figure 3.9:
Figure 3.9: Creating a resources file
We can create the Resources.resx
resources file in the Properties
folder.
To support different cultures, we can add additional resources files with cultural...