0

Web.config

<profile>
      <properties>
      <add name="Language"  />
      </properties>
</profile>

Default.aspx.cs

protected void Page_Load(object sender, EventArgs e)
    {
        Profile.Language = "fr";
        string strCultur = Profile.Language;
        Page.Culture = strCultur;
        Page.UICulture = strCultur;
        lblLabel.Text = GetLocalResourceObject("lblLabelResource1").ToString();
    }

App_LocaleResource:

  • Default.aspx.resx
  • Default.aspx.fr.resx

これは私のエラーです:

Object reference not set to an instance of an object.

テキストをフランス語にしたいのですが、何が間違っていますか?

4

1 に答える 1

1

これを試すことができますか?

またはここでもっと見る

win form c# -> リソースでWinFormの言語を変更

using System.Globalization; 
using System.Threading;


//LanguageString sample
String languageString = "fr-FR";
//Apply new language
Thread.CurrentThread.CurrentUICulture = new CultureInfo(languageString);
Application.Run(new Form());

asp.net c# -> http://forums.asp.net/t/1244851.aspx/1

protected override void InitializeCulture()
    {
        Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-GB");
        Thread.CurrentThread.CurrentCulture = new CultureInfo("en-GB");

        base.InitializeCulture();
    }
于 2013-03-06T16:56:54.017 に答える