ASP.net 2.0 implementing multi-language localization applications

Source: Internet
Author: User
Tags resource

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>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.