Please share you experiences regarding how you localized your WPF applications to support multiple languages and any resources that helped you in it?
Thanks for your feedbacks.
Please share you experiences regarding how you localized your WPF applications to support multiple languages and any resources that helped you in it?
Thanks for your feedbacks.
For our WPF application, all of our strings are localized as resources in a ResourceDictionary that we put in a .xaml file named after the language (like en-US.xaml, ja-JP.xaml, etc).
For example, somewhere in the application a button might look like this:
<Button Content="{StaticResource Strings.FooDialog.BarButtonText}"/>
Each ResourceDictionary for the different languages would contain a version of it:
<sys:String x:Key="Strings.FooDialog.BarButtonText">Bar!</sys:String>
The ResourceDictionary is dynamically connected to the Application.Resources at runtime like this:
private static void LoadLocalizedStrings(CultureInfo uiCulture)
{
ResourceDictionary stringsResourceDictionary = new ResourceDictionary();
stringsResourceDictionary.Source = new Uri(@"pack://application:,,,/Resources/Strings/" + uiCulture.Name + ".xaml");
Application.Current.Resources.MergedDictionaries.Add(stringsResourceDictionary);
}
You might be interested in this article about WPF localization with the "old" stable ResX files: