I know everything about the old school: use the resource file with the extension .resx, provide the NeutralResourcesLanguage attribute, the neutral resource is compiled into the assembly, and you can collect satellite assemblies from other localized resources (blabbah. De-DE.resx). Visual Studio also generates strongly typed .cs from resources, so they are easy to use from code (Properties.Resources.Default.WhateverStringResource).
I just found out a new WPF way: put the resources in a .xaml file, use the UICulture tag in .csproj to put the .baml resource in the satellite assembly or not, and put the .baml resource in the main assembly. These resources are easy to use inside .xaml, but AFAIK, not from code, because the .cs file is not auto-generated.
So maybe I'm very wrong, but I have a few questions. "Seriously, what the hell is it now?" being the first. To make my disclosure reliable, just create a new WPF application in Visual Studio 2010: you will get .xaml files, and there will also be an empty property Properties \ Resources.resx. There you have it, so they must coexist.
First of all, do I need both a new and an old school? I don't see an easy way to use strongly typed .xaml resources from code. Why not? Perhaps there is a way to generate them in .cs files, and I just don't know about that.
Now the big problem is that I cannot use .resx resources from .xaml. WHAT FOR?! The designer of Visual Studio 2010 is sure that he does not see them, but again, this can be bad.
MSDN suggests using the UICulture tag. It puts the .baml resource in the satellite assembly, so the assembly does not even contain a neutral one. But this does not work for the neutral resource of the old school, AFAIK, non-localized .resx, you need to go into the main assembly. Therefore, if I want to use the new and old school in the same project, I cannot use the UICulture tag, I need all the neutral resources in the main assembly. Am I the only one who bothered this?
So the questions are:
- Is it possible to use resources from .xaml in code in a strongly named way, like in .resx files?
- Is there a way to use .resx resources in .xaml that don't break with SilverLight?
- Is it just me or .baml localization is much more complicated than .resx localization? (dll parsing, recompiling, editing csv, only editing the .resx file)
- Is it possible to compile neutral .resx into a satellite assembly, as with UICulture in wpf?
fejesjoco
source share