1. Setting up the current culture
Page classes have two important properties that affect localization in the <% page% > instruction settings:
1). UICulture This property is used to specify the resource file that is loaded into the page, and the resource file can contain a translated version of the specific language of the page's text content. Its attribute value can be neutral culture can also be a specific culture (described below)
2). Culture This property determines the formatting and sorting of dates, numbers, currency units, and so on. This property value can only be specific to a culture.
The above UICulture and culture attributes all accept the standard culture name as their value. (Standard culture name can be viewed in http://www.IETF.org)
Note: The UICulture property determines which resource file is loaded for the page, and the culture determines the date, number, and number of currency formats
The common cultural names are as follows:
Zh-cn=chinese (a)
En-us=english (United States)
En-gb=english (United Kingdom)
Note: Each cultural name is composed of two parts. The first part represents the language code, and the second part represents the country/region code
i.e. culture name = Language code-represents country/region code
If only the language code, and no country/region code of the cultural name is a neutral culture (neutral culture)
If there is a language code, and the country/region code culture name is specific culture (specific culture)
1.1 Manual Settings culture
Instances are set manually in the page directive:
[Copy to Clipboard]
CODE:
<%@ Page Language="C#" UICulture="id-ID" Culture="id-ID" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
void Page_Load()
{
this.lblToday.Text = DateTime.Now.ToString("D");
this.lblPrice.Text = (512.3m).ToString("c");
}
</script>
<title>印度尼西亚文化</title>
<body>
<form id="form1" runat="server">
<div>
今天的日期是:
<asp:Label ID="lblToday" runat="server" />
商品的价格是:
<asp:Label ID="lblPrice" runat="server" />
</div>
</form>
</body>