views:

59

answers:

1
protected override void InitializeCulture()
{
    ...
    Thread.CurrentThread.CurrentUICulture = frInfo;
    ...
}

We know we can set currentUICulture to make current page load language specific resource file. My questions are: When and which function is called to load resource for current page in ASP.NET? What is the internal mechnism of localizing a page?

+1  A: 

I suggest you read the info found at this link.

Basically, you tell ASP.NET to load text from a user file in 3 ways:

<asp:Button ID="btnSubmit" runat="server" Text="<%$ Resources:btnSubmit.Text %>" />

or

btnSubmit.Text = this.GetLocalResourceObject("btnSubmit.Text").ToString();

or, after you have created your entire page, you use the implicit resource binding:

<asp:Button ID="btnSubmit" runat="server" meta:resourcekey="btnSubmit" />

Implicit resource binding can be added very easily by going to Tools -> Generate Local Resource in visual Studio when you are in design view of an ASP.NET Page.

Colin