.NET-全球化与本地化-深入研究系列(1) WinForms WebForms本地化
1.Windows Application 本地化
1.1 使用VS生成资源文件
- 首先,设置form类的localizable属性为true。
- 在winform上创建所需的控件及布局。
- 在form类的language属性中选择需要的本地化语言。
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(Request.UserLanguages[0]);
1 using System.Threading;
2 using System.Globalization;
3
4 namespace WindowsApplication_Globalization
5 {
6 public partial class Form1 : Form
7 {
8 public Form1()
9 {
10 //it will determine which resources are loaded for the form
11 Thread.CurrentThread.CurrentUICulture =
12 CultureInfo.CreateSpecificCulture("zh-CN");
13
14 InitializeComponent();
15 }
16 }
17 }
2 using System.Globalization;
3
4 namespace WindowsApplication_Globalization
5 {
6 public partial class Form1 : Form
7 {
8 public Form1()
9 {
10 //it will determine which resources are loaded for the form
11 Thread.CurrentThread.CurrentUICulture =
12 CultureInfo.CreateSpecificCulture("zh-CN");
13
14 InitializeComponent();
15 }
16 }
17 }
Walkthrough: Localizing Windows Forms
2.ASP.NET Web Application 本地化
Globalization Architecture for ASP.NET
http://msdn.microsoft.com/en-us/library/aa478974.aspx
Internationalization Overview
http://www.aspalliance.com/quickstart/aspplus/doc/internationalization.aspx