Search code examples
c#asp.netasp.net-mvclocalizationembedded-resource

Localization using .resx files working on LocalHost but not server MVC


I have setup localisation and debugged it completely fine on IIS Express on my local machine. I have uploaded the compiled resource .dll files located in the /bin/LANG_CODE folders to my server and edited the Web.Config.

I added this to the module tags: <add name="LangQueryAppenderModule" type="Central.HttpModules.LangQueryAppenderModule" />

And I added this to the system.web tags in the Web.Config: <globalization fileEncoding="utf-8" requestEncoding="utf-8" culture="auto" uiCulture="auto" enableClientBasedCulture="true" />

The behaviour on the localmachine is the complete desired result in that when I type localhost:port/controller it will redirect me to localhost:port/en/controller and if I change the language code to fr it will display the correct string values for the French version of my website.

On my published version of the site http://example.com/controller it will correctly redirect to me http://example.com/en/controller but when I change the language code to any of the supported it will still display the English string values rather than displaying the desired language like my local machine does.


Solution

  • This was an issue with Visual Studio 2015's FTP publishing service. For some reason the .dll resource files were not uploading when I clicked on the folders to upload, even though the UI says otherwise. I had to expand the folders where the resource.dll files were located and individually click and upload for them to be successfully uploaded to my server.

    The joys of being a programmer!