Wpf – the best way to localize a WPF application, sans LocBAML

globalizationlocalizationwpfxaml

There seems to be no good way to localize a WPF application. MSDN seems to think that littering my XAML with x:Uid's, generating CSV files, and then generating new assemblies (using their sample code!) is the answer. Worse, this process doesn't address how to localize images, binary blobs (say, PDF files), or strings that are embedded in code.

So, how might you localize an application that:

  1. Contains several assemblies
  2. Contains images and other binary blobs (eg: PDF docs) that need to be localized
  3. Has string data that isn't in XAML (eg: MessageBox.Show("Hello World");)

Best Answer

You should have a look at the article and code available here. It describes different ways of localizing WPF apps, using LocBaml, custom markup extensions, or attached properties. IMHO the best solution is to use the markup extensions and Resx resources. The code contains a localization framework for doing that.