views:

223

answers:

1

I have a very weird problem with resx based localization.
At first, let me explain, how it is done for me right now.
It is ASP.NET MVC project. I have two assemblies: web and domain. Web contains all MVC related stuff, and domain, well, contans domain classes. Also, in domain assembly I store a lot of static resources for localization(I am building site with 3 different languages available).

So I have Localization folder in this domain assembly and there are files like:
CheckoutStrings.resx, CheckoutStrings.en-US.resx, CheckoutStrings.et-EE.resx and so on.

Now the weird thing is that this is all working really nicely on my local machine using both VS Developing Server and IIS 7.5. But when I upload solution to my web server, which is Windows Server 2008 R2, so it is IIS 7.5 as well, my localization suddenly stops working.

I tried to output

Thread.CurrentThread.CurrentUICulture

in my views, just before outputting localized strings.
It gives me selected culture, which is right, but nevertheless strings are rendered as a fallback value, not localized one.

I am really stuck here, hope anyone has a clue what is going on...

+1  A: 

Could it be that the localization files are simply not found and you are falling back to the "default language"? Are you maybe deploying into GAC on the server but running it from a /bin folder with subfolders on your dev machine? Have you tried using fuslogvw.exe to see where the code comes from?

Be aware that to see the loads of satellite assemblies you have to do some registry "hacks" - http://msdn.microsoft.com/en-us/library/e74a18c4(VS.71).aspx :

To log bind failures to satellite assemblies Set the HKLM\Software\Microsoft\Fusion\LogResourceBinds registry value to 1 (the value is a DWORD).

naivists
1. how can it be that they are not found?2. no, i'm not deploying to gac3. never heard about fuslogvw before, thanks for a tip!
I've set LogResourceBinds to 1 like you said, after that fuslogvw showed some binding logs, but nothing specific to my application. And other stuff from my domain assembly definetely works, so I can't think of any reason for embedded resources to not be loaded. What really strikes me is that it works on local machine, and doesn't on server.
I found out, that like usual it was my mistake. We use svn/export for deploying site and somehow svn didn't see newly generated sattelite assemblies. So IIS loaded only domain dll without satellites.
Good to hear that you have found the bug.
naivists