的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:
这是我的错误:
Object reference not set to an instance of an object.
我想用法语发短信怎么办?
答案 0 :(得分:1)
你可以尝试一下吗?
或者在这里看得更多
赢取表单c# - &gt; Change language of WinForm with resource
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# - &gt; 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();
}