Skip to main content

Microsoft Silverlight

Answered Question How to have localization follow browser languageRSS Feed

(0)

Matt Brooks
Matt Brooks

Member

Member

4 points

6 Posts

How to have localization follow browser language

I am developing a Silverlight 2 application.

I have been able to embed multiple string resources into my .xap file.  I have found how I can select which language to display by adding:

<param name="culture" value="de" />
<param name="uiculture" value="de" />

To my <object> section in html.

What I would like to do is have the culture and uiculture follow the language(s) configured in my browser (auto detect).

Does anyone know how I can do that with javascript?  Or straight html?

Thanks for the help,

Matt

slyi
slyi

Participant

Participant

818 points

251 Posts

Re: How to have localization follow browser language

Please see http://silverlight.net/forums/p/14007/50506.aspx#50506

<param name="culture" value="auto" />
<param name="uiculture" value="auto" />

Matt Brooks
Matt Brooks

Member

Member

4 points

6 Posts

Re: How to have localization follow browser language

 I am using Silverlight 2 Beta 2.

<param name="culture" value="auto" />
<param name="uiculture" value="auto" /> 

This does not work for me.  I am using Firefox and set one and only one language, de.  My app still showed en-US as my culture and UICulture.

Any other ideas?

Thanks,

Matt

slyi
slyi

Participant

Participant

818 points

251 Posts

Re: How to have localization follow browser language

That is strange i just tried it now as well and it doesnt seem to work either, maybe a bug in beta 2. It was meant to be working in beta2.

As a workaround you could add it dynamiclly on the server side eg:

<%@ Page Language="C#" AutoEventWireup="true" UICulture="auto" Culture="auto" %><%@ import namespace="System.Threading" %>

<param name="Culture" value="<%=Thread.CurrentThread.CurrentCulture.Name %> />
<param name="UICulture" value="<%=Thread.CurrentThread.CurrentCulture.Name %>" />

 

 

 

 

 

slyi
slyi

Participant

Participant

818 points

251 Posts

Answered Question

Re: How to have localization follow browser language

Actually it is working eg: http://cid-2b248d261d0e0035.skydrive.live.com/self.aspx/Public/culture-equals-auto.zip

But it is not based on user accept language host header list, from you user browser language, as this is not available on the client side, only server side. What is available on the client side is OS language which you change in control panel.  http://www.microsoft.com/library/media/1033/windowsxp/images/using/setup/winxp/regional-options-click-ok.jpg

Please note the server side method is much more targeted, and i recommend this more than the client side polling.

 

salonVB
salonVB

Member

Member

4 points

6 Posts

Re: How to have localization follow browser language

Thanks to all for their quick and kind response, the problem is solved!

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities