I am running into trouble given the following setup:
- Operating System is Windows 7 English, Format is German (Germany),开发者_如何学运维 Location is Germany
- My Application (MVC2, .NET 4) contains 2 Resource-Files, Labels.resx (containing German content) and Labels.en.resx (containing English content)
- CurrentCulture and CurrentUICulture are set to de-DE very early (by initializing the controller)
But the framework chooses to take the Labels.en.resx instead of using what I am expecting, the default one. So why does the fallback mechanism not work here? Any ideas?
Seems to be a bug related to ASP.NET 4.0. When compiling the project against 3.5 all works as expected.
It looks like the fallback works a bit differently.
If you have your browser languages set to eg.
Polish (pl), English GB (en-GB), English (en)
and you have corresponding resource files + a default resource file (e.g Literals.pl.resx, Literals.en-GB.resx, Literals.en.resx, Literals.resx) the the fallback mechanism will go:
- Literals.pl.resx -> Literals.resx (if you have Polish first in your browser)
- Literals.en-GB.resx -> Literals.en.resx -> Literals.resx (if you have English GB first in your browser)
The fallback works for locale, not language.
精彩评论