开发者

Asp.net 3.5 localization, can't get it working

开发者 https://www.devze.com 2023-01-11 01:00 出处:网络
This is really simple, can\'t understand why I can\'t get it working. In asp.net 3.5 I\'m trying to use localization and French using Global Resources. But it never uses the French resource file.

This is really simple, can't understand why I can't get it working. In asp.net 3.5 I'm trying to use localization and French using Global Resources. But it never uses the French resource file.

I have three files: Default.aspx, Resource.resx, Resource.fr.resx.

In Default.aspx:

<%@ Page Language="C#" AutoEventWireup="true" Culture="fr-FR" CodeFile="Default.aspx.cs" Inherits="_Default" %>

开发者_JAVA百科<asp:Label ID="lblWelcomeMsg" runat="server" Text="<%$ Resources:Resource, welcomeMessage %>"></asp:Label>

In App_GlobalResources/Resource.resx:

Name: welcomeMessage
Value: Welcome

In App_GlobalResources/Resource.fr.resx (have also tried using Resource.fr-FR.resx):

Name: welcomeMessage
Value: Bonjour

The problem is that it always says "Welcome" even if I set the culture to "fr-FR". I have also tried to set the language in the browser but nothing happens. What am I doing wrong?


I needed to set the culture in web.config for example (for auto):

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

精彩评论

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

关注公众号