在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
\App_GlobalResources Folder
WebResource.zh-CN.resx
In order to see the Chinese text, change your preferred culture in the Microsoft Internet Explorer browser by choosing Tools➪Internet Options. This pulls up the Internet Options dialog. From the first tab, General, you can click the Languages button to pull up a dialog that enables you to specify the Chinese language as your preferred language choice. After you have added the Chinese language to the list, be sure that it is the uppermost choice in the dialog.
\App_LocalResources
❑ Default.aspx.zh-CN.resx
Now, the resource declarations used on the Default.aspx page will be retrieved from the appropriate file found in the \App_LocalResources folder. By default, the Default.aspx.resx resource file will be used if another match is not found. If the client is using a culture specification of fi-FI (Finnish), however, the Default.aspx.fi.resx file will be used instead. To use implicit localizationMake sure that you have local resource files (.resx files) that meet the following criteria:
<asp:Button ID="Button1" runat="server" Text="DefaultText"
meta:resourcekey="Button1" /> To use explicit localization <%$ Resources:Class, ResourceKey %>
<asp:Button ID="Button1" runat="server"
Text="<%$ Resources:WebResources, Button1Caption %>" />
<asp:Label ID="Label1" runat="server" Height="101px" Text="<%$ Resources:, Label1.Text %>" Width="122px"></asp:Label>
To retrieve resource values programmatically
<script runat="server">
protected void Button1_Click(object sender, EventArgs e) To retrieve global resources using strong typing
String welcome;
welcome = Resources.WebResources.WelcomeText; How to: Set the Culture and UI Culture for ASP.NET Web Page Globalization
In an ASP.NET Web page, you can set to two culture values, the Culture and UICulture properties. The Culture value determines the results of culture-dependent functions, such as the date, number, and currency formatting, and so on. The UICulture value determines which resources are loaded for the page.
<configuration>
<system.web> <globalization culture="Auto" uiCulture="Auto"/> </system.web> </configuration>
<%@ Page UICulture="en-US" Culture="en-US" %>
To set the culture and UI culture for an ASP.NET Web page programmatically
protected override void InitializeCulture()
} Select an Encoding for ASP.NET Web Page Globalization
<configuration>
<system.web> <globalization fileEncoding="utf-8" requestEncoding="utf-8" responseEncoding="utf-8" culture="en-US" uiCulture="de-DE" /> </system.web> </configuration>
<%@ Page RequestEncoding="utf-8" ResponseEncoding="utf-8" %>
|
请发表评论