chapter 3: 'An Introduction to Internationalization'
Excerpted from the book ".NET Internationalization," ISBN 0321341384, Copyright 2006. Written permission from Addison-Wesley is required for all other uses. Copyright © 2006 Addison-Wesley. All rights reserved.
DateTime dateTime = new DateTime(2002, 2, 13);
string dateTimeString = dateTime.ToString("MM/dd/yyyy");
These preconceptions must be eliminated from the code. Many of these preconceptions are obvious, such as the date/time format, but many are not so obvious. Globalization issues include date/time formats, number formats, currency formats, string comparisons, string sort orders, calendars, and even environmental conditions. Do you assume, for example, that the
Program Files folder is always "
Program Files"? (It isn't.) Or that the first day of the week is Sunday, or that everyone uses a 12-hour clock? The subject of globalization is fully covered in Chapter 6, "Globalization," but the bottom line is that if you always use the .NET framework globalization classes and you always use them properly, you will greatly diminish the number of globalization problems in your applications.
MessageBox.Show("Insufficient funds for the transfer");
To make the application "localizable," we must rewrite this code to make this resource load at runtime. You will see how to achieve this later in this chapter.
Internationalization Terminology Confusion
The term "globalization" is used to describe the entire process. whereas the term "internationalization" is used to describe sometimes world-readiness and sometimes globalization. Unfortunately for us, the rest of the industry has the upper hand in this issue. In the mid-1990s, Microsoft transposed the meanings of internationalization and globalization, and it stuck. All Microsoft documentation (including namespaces in the .NET Framework) uses the Microsoft interpretations of these terms. So if you read documentation from non-Microsoft sources, be aware that it might use the same words but have different meanings.
Chapter 3: 'An Introduction to Internationalization'
Visit the Addison-Wesley website for a detailed description and to learn how to purchase this title.
Throughout this book, I use various internationalization terms to describe different parts of the internationalization process. In this section, I identify these terms and describe their meaning. Figure 3.1 shows the hierarchy of internationalization terminology as adopted by Microsoft. It shows the term as an umbrella for the various stages in the process: world-readiness, localization, and customization. Let's take a look at each term in turn. is an umbrella term for all the functionality that developers must provide to complete their part of the internationalization process. This includes globalization, localizability, and customizability. is the process of engineering an application so that it does not have cultural preconceptions. For example, an application that converts a to a string using this code has a cultural preconception that the date format should be : is the process of adapting an application so that its resources can be replaced at runtime. , in this context, are primarily the strings used in your application, but also include the bitmaps, icons, text files, audio files, video files, and any other content that your users will encounter. In this code, there is a hard-coded, literal use of a text string: is the process of adapting an application so that its functionality can be replaced at runtime. For example, taxation laws vary considerably from location to location; California sales tax, for example, is not the same rate and does not follow the same rules as, say, Value Added Tax in the U.K. (or in the Netherlands, for that matter). A "customizable" application is one that is capable of having critical parts of its functionality replaced. Often this means using a plug-in architecture, but it might be sufficient to store a set of parameters in a data store. You will encounter customizability less than localizability—or, indeed, never. Customizability is also referred to as , especially on Microsoft Web sites. All these steps (globalization, localizability, customizability) together make up the work that developers must complete as they refer to adapting the application's source code to make it ready for localization and customization. is the process of creating resources for a specific culture. Primarily, this involves translating the text of an application from its original language into another language, such as French. Often the translation process is performed by a translator, but it might also be performed by a machine (known as machine translation, or "MT") or by a bilingual member of staff. In addition, the localization process might or might not include the redesign of forms and pages so that translated text doesn't get clipped or truncated and so that the form or page still looks correct in the target culture. It also involves translating other resources into culturally correct resources for the specific culture. Aclassic example of a culturally unaware resource is the first Windows version of CompuServe's e-mail program. The Inbox was represented by an icon for a U.S. metal mailbox with a flag indicating that mail had arrived. This icon is specific to the U.S. and had little or no meaning outside the U.S. In this case, the entire icon needed to be changed, but in other cases, localization might simply require changing a color. For example, a red "Stop" sign doesn't convey a warning in China or Japan, where red can indicate prosperity and happiness. is the process of creating a specific implementation of functionality. Whereas customizability gives an application the potential to be customized, customization is the implementation of a specific case. If your application supports customization through a plug-in architecture, this step will likely be performed by developers. The developers might be your own developers, but in highly customizable applications that offer an open plug-in architecture, these developers could be anyone. The terminology described so far and the terminology used throughout this book use the interpretations used by Microsoft. This makes sense because this book focuses on a Microsoft technology as implemented by Microsoft. You should be aware, however, that the rest of the industry does not adhere to these definitions. Primarily, the meanings of and are transposed. Figure 3.2 shows the broad hierarchy of internationalization terminology according to the rest of the industry.