Software internationalization is in software design and document development process, enables the function and the code design to be able to handle many languages and the cultural custom, when creates the different language version, does not need to redesign the source code the software engineering method. This is very common in many mature software development platforms. For. NET developers, we can generally implement the internationalization of the software in two different ways.
Language configuration file
Resource file
In the. NET platform, the internationalization of software depends primarily on the internationalization of the worker threads. In the processing thread of the. NET Framework, we set the Thread.CurrentCulture property to implement the format of the default values for date, time, number, currency value, text, load convention, and string comparisons, which are derived by default from the Control Panel The user culture in regional and language options. Of course, the Thread.CurrentCulture property value can also be forced to be changed manually during the software operation. The CurrentUICulture property is used to determine the resource format that needs to be presented to the user, which is most useful for the operational interface of the software, because it identifies the language that should be used when displaying UI elements. In. NET, the software is usually set up with different UI resource files, which enables the software runtime to select different language resource files to render the software interface through CurrentUICulture attribute values. The CurrentUICulture and CurrentCulture properties of a thread are generally set to the same CultureInfo object, which means that it uses the same language, country information, but it can also be set to a different object. For example, when an American borrows an operating system in Beijing to work in a simplified Chinese version of the computer, this way the software can be used to meet the needs of American users.
The following example explains that for different Thread.CurrentCulture property values, the same date string is converted to a date type to produce a different result
static void Main (string[] args)
{
string birthdate = "02/06/2013";
datetime datetime;
DateTime = DateTime.Parse (birthdate);
Console.WriteLine (DateTime.ToString ("yyyy mm month DD day"));
Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo ("EN-GB");
DateTime = DateTime.Parse (birthdate);
Console.WriteLine (DateTime.ToString ("yyyy mm month DD day"));
Console.read ();
}
The following example explains that for different Thread.CurrentUICulture property values, the framework selects different resource files to read the values in order to present different information to users who use different languages. Before running, you need to establish the following resource files in your project.
The contents of each resource file are as follows: