views:

872

answers:

3

Its my understanding that the recommended approach to localization in WPF is to use the LocBaml tool to extract the localizable items into e.g. a csv file, translate the items into the desired language and regenerate a new sattelite assembly from this csv file. However from my experiments this seems to conflict with the generation of satellite assemblies from resources.resx files since neither is combining the resources into the single resource file but simply override any existing satellite assembly.

Is there a recommended approach (or even better, an existing tool) for doing a "merge" of output from LocBaml /generate and the output of running resgen on a resources.resx file (which is by default done by VS on builds). Are anybody out there tackling the same issues?

+1  A: 

I prefer to use the WPF Localization Extension project that you can found on codeplex to localize my WPF project.

It lets you use the same approach than WinForms and is much easier to use than LocBaml.

sacha
A: 

Googled around a bit and found this page describing a few ways to use LocBaml which iuncludes a very detailed descripion on how to merge the resources.resx and locbaml generated resources into a single file (using al.exe).

Localizing WPF using LocBaml

The page describes three ways to use LocBaml and I was looking for the last step in approach 3. Lots of good stuff in that article by the way

soren.enemaerke
+2  A: 

You have to manually do this generating .resources from LocBaml and then merging the Resx and BAML resources using the Assembly linker.

The process looks something like this:

LocBaml.exe /generate ..\obj\WpfLocalization.g.en-US.resources 
            /trans:Res\de.csv /out:de /culture:de

REM Combine resource files w/ Assembly Linker
al /template:WpfLocalization.exe 
   /embed:de\WpfLocalization.g.de.resources 
   /embed:..\..\obj\WpfLocalization.Properties.Resources.de.resources   
   /culture:de  /out:de\WpfLocalization.resources.dll

(everything on one line in a batch file).

You can put the above in a batch file customized for your project. Remember LocBaml has to in the same folder as your output files. You can add this as a post build task.

Rick Strahl