开发者

Resource files not loaded properly in the silverlight client

I have a SL 4.0 application hosted on IIS with a possibility to change GUI language. The problem is that hosted on one machine , language functionality works and on the other machine not. Inside this piece of code:

        Thread.CurrentThread.CurrentCulture = new Cult开发者_StackOverflowureInfo(message.NewCulture);
        Thread.CurrentThread.CurrentUICulture = new CultureInfo(message.NewCulture);

on Windows7 it does update UICulture with correct resource file and on Windows Server 2008 it does not. IIS settings on both systems seem to be the same. Any suggestions where to look?


You might want to take a look at the Blog entry made by Tim Heuer on the subject.

http://timheuer.com/blog/archive/2009/08/26/silverlight-string-localization.aspx

Using this blog post, I was able to get Globalization/Localization implemented in a short amount of time and minimal effort.

It sounds like you need to take a look at the Access Modifier section in the designer. You'll need to set this to Public in order to use it in XAML binding. Also check that all the RESX files are marked as Embedded Resource in the properties for the files.

Additionally make sure your string resource dictionaries have extensions to something similar:

Resource files not loaded properly in the silverlight client

P.S. I hope you'll read Tim's blog entry, he goes into a lot more detail than what I've explained. Also from my personal experience, I wasn't able to dynamically reload the language on the fly until I took a look the section on the blog post titled "Public modifier workaround and dynamically setting the culture".


R-Click the assembly(ies) containing your localized files, select unload project and then edit the project file(s). The project files are in XML format. Look for a XML tag related to SupportedCultures (or something like that). Make sure that your cultures are in the list.

Localization didn't want to kick in for me until I got that resolved.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜