Martijn
Martijn

Reputation: 24789

ASP.NET C# language file doesn't work

I just started using explicit resource files. I performed these steps:

When I run this page, I always get the dutch version. Whether I set the language in my browser (FF and IE7) or not, I always get the dutch version. When I request the browsers' language I get en-us (using: Response.Write(Request.Headers["Accept-Language"]);).

What's the issue and how can I fix it?

Upvotes: 2

Views: 2090

Answers (2)

M4N
M4N

Reputation: 96571

Setting the language preferences in the browser is not enough. You have to make sure that the current thread's Culture and UICulture properties are set accordingly in ASP.NET.

You can do this either programmatically or declaratively on your page (Culture and UICulture attributes of the <%@Page %> directive).

Or you can let ASP.NET set them automatically by setting the web.config entry shown below and setting the Culture/UICulture properties of the page/masterpage to "auto".

// web.config:
<globalization enableClientBasedCulture="true" ...>

// page/masterpage:
<%@ Page ... Culture="auto" UICulture="auto" %>

Check this page for details.

Upvotes: 2

Norbert B.
Norbert B.

Reputation: 5730

@martijn:

  1. check the browsers caching settings. Caching should be off all the time when developing.

  2. Install Firebug (FF) and Fiddler(IE) to see what's being transfered over the wire.

Hope this helps...

signed,

A fellow countryman

Upvotes: 0

Related Questions