Web Deployment Project isn't working with multi-lingual resources.

by Dominic Zukiewicz 13. July 2007 14:54
Yesterday and today, the project I was working on required catering for Mandarin and English.

On my machine, the one I build the project on, the multi-lingual features worked fine, but after using the WDP (Web Deployment Projects) found that the site was always defaulting to English, even if the browser was configured as Chinese.

I worte a test page, which too confirmed the website was picking up the correct culture, but for some reason ASP .NET wasn't changing it.

After hours of torment, I found that 2 steps have to take place. One which I forgot to code (oops!) and one which sorted the problem once and for all.

1) Change web.config to automatically configure the language

<globalization culture="auto" uiCulture="auto"/>

2) Force the ResourceManager to use the correct language

For some reason, with the WDP this wasn't happening, so I have to specify it explicitilly:

protected override void InitializeCulture()
{
     Resources.ProjectResources.Culture = Thread.CurrentThread.CurrentUICulture;
     base.InitializeCulture();
}


It now works absolutely fine.

Tags:

Powered by BlogEngine.NET 1.5.0.7
Theme by Interakting

Interakting

A full service digital agency offering online strategy, design and usability, systems integration and online marketing services that deliver real business benefits and ensure your online objectives are met.

Calendar

<<  July 2010  >>
MoTuWeThFrSaSu
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678

View posts in large calendar