English 中文(简体)
2. 当地化
原标题:Localization in .aspx and .ascx

我有一个网页(aspx),在网页上使用主页,并装上用户控制(ascx)。 我正在执行网页上的当地化和用户控制。 然而,地方化只是在用户控制方面开展工作,而不是在下页。

我的所有网页都有一个基页级,在基页内,我凌驾于最初的雕塑(Culture)方法之上,我在此确定了目前的文化和当前文化。 为了测试目的,我专门将文化和当前文化定为“fr-CA”。

Thread.CurrentThread.CurrentCulture = new CultureInfo("fr-CA"); Thread.CurrentThread.CurrentUICulture = new CultureInfo("fr-CA");

我有为.语(即“英语”和“视力演播室”等缺省语言(即“英语”和“成人”)而生成的微量文档。

Not sure why the localization is not working on the .aspx file but works fine on the user control.

问题回答

您可优先于<代码>Page s OnInit 方法并设定Page.UICulture 其中的财产。

另外,你是否正确地把你的法语资源命名为你们? 我建议,一旦你不使用一个以上的法语,就使用“fr”而不是“fr-CA”。

查阅本页的指示:

http://msdn.microsoft.com/en-us/library/bz9tc508(v=VS.85).aspx

protected override void InitializeCulture()
{
    string selectedLangauge = "fr-CA";
    Thread.CurrentThread.CurrentCulture = 
        CultureInfo.CreateSpecificCulture(selectedLanguage);
    Thread.CurrentThread.CurrentUICulture = new 
        CultureInfo(selectedLanguage);

    base.InitializeCulture();
}

我的猜测是,你不会过早地改变文化,但用户控制却因为追赶活动而发挥作用。 (http://msdn.microsoft.com/en-us/library/ms178472.aspx# submissions_up_events_for_plus_controls iii





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签