First, you need to create an ASP. NET Web Application. Then Right-click the project file Add-> Add ASP. NET Folder-> App-GlobalResources.
After creating a resource folder, add a resx file to the folder. Here, I add a LocalText. resx file.
Set the Value of Name and Value, as shown in.
Save and copy LocalText. resx, paste it to the App_GlobalResources folder, and rename it LocalText. zh-CN.resx.
Set the Value of Name and Value.
On the page, we can use
<Asp: Button ID = "submit" runat = "server" Text = '<% $ Resources: LocalText, ButtonText %>'/>
Then we need to define a public class BasePage. The BasePage inherits from System. Web. UI. Page, and the Page inherits from BasePage.
In BasePage, We need to override the InitializeCulture method. The detailed code is as follows:
The InitializeCulture method is executed when all pages are loaded.
Take the button used in the new Default page as an example. When a user accesses the Default page in a browser with lang = zh-CN, the button is displayed and submitted. When you access the Default page with lang = en-US, the button displays the submit.