C # Introduction to localized internationalization Solutions

Source: Internet
Author: User

 

Visual Studio provides a complete solution for. NET Program localization. In order to enable Software Internationalization and localization, this article provides a simple description and tips.

I. Internationalization solution of forms

After creating a new WinForm solution, select the main form, right-click to view the properties, find the Localizable attribute, set it to True, find the Language attribute, and select the Language to switch, for example, English (U.S.), Chinese (simplified, Chinese), etc. In this case, the style and Language of the form in the Language are designed according to the actual situation.

 

Figure 1 Form attribute settings

 

Figure 2 resource files automatically generated based on the selected language

Ii. Use the CultureInfo class to implement international solutions

The CultureInfo class contains regional-specific information, such as languages, countries, calendars, and regional conventions.

 

 

Using System;

Using System. Collections. Generic;

Using System. Linq;

Using System. Windows. Forms;

 

Namespace LocationForm

{

Static class Program

{

/// <Summary>

/// Main entry point of the application.

/// </Summary>

[STAThread]

Static void Main ()

{

Application. EnableVisualStyles ();

Application. SetCompatibleTextRenderingDefault (false );

// System. Threading. Thread. CurrentThread. CurrentUICulture = new System. Globalization. CultureInfo ("en-US ");

System. Threading. Thread. CurrentThread. CurrentUICulture = new System. Globalization. CultureInfo ("zh-CN ");

Application. Run (new Form1 ());

}

}

}

Iii. Effects

 

 

Iv. References

Coding and localization http://msdn.microsoft.com/zh-cn/library/h6270d0z.aspx

 

From Xue jingming's column

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.