This chapter covered a lot. You saw how to
In addition, you learned how to store database credentials in the registry and how to retrieve those credentials in a secure manner. You examined a host of security issues that allow you to determine what possible security issues you might face on a particular project and how to get around some of them.
Chapter 1, "Understanding Application Architecture: An Overview," mentioned that the business world is becoming global. Boundaries are being blurred every day,
This chapter introduces some of the ideas and best practices you will need to know to globalize applications. In addition, you will
This chapter is not an
is the process of preparing an application to be localized.
is the process of taking an application and adding in the resources used to display the interface in a
I am one of those language-inept people. To quote Bruce Willis in
The Fifth Element
, "I speak two languages, English and Bad English." Because of this
You need to perform a couple of steps to
Ensure there is enough space in labels to hold the maximum
Store all strings (and images) if they are to be localized, externally of the executable.
Store all data in the database using Unicode encoding.
Do not concatenate strings at runtime for display.
There is a much longer list of best practices in the MSDN help documentation under "Globalization, Best Practices" and "Localization, Best Practices."
These are the only areas covered in this chapter because each requires some technical insight. Most of the other globalization issues revolve around the do's and don'ts of different political systems, cultures, and so on. You do have one advantage using the .NET Framework: All controls that display text are Unicode enabled, so character sets are no longer an issue.
This chapter is about converting an application to a different language, Appendix A contains a small example of adding special characters (including foreign language
So, let's examine each of the four requirements listed previously.
Ensure there is enough space in labels to hold the maximum size string
: When you create labels to hold text that describes information in a textbox or listbox, you
Birth Date (English)
Date de naissance (French)
La Fecha del nacimiento (Spanish)
As you can see, it will not do to size labels to their minimum size when writing an application that eventually needs to be localized.
Store all strings (and images) if they are to be localized, externally of the
: When you place a label on a form, you should store the text of that label in a place other than the text property of that label. In this case, I am
Store all data in the database using Unicode encoding
: Ensure that all character fields are created using the Unicode version (noted in SQL Server as
plus the datatype; for example,
). This also covers the fact that
Do not concatenate strings at runtime for display : This is a big no-no when dealing with foreign languages. Take the following example: 
English: Release the hold and start the second by one press on S1 at the appropriate time.
French translation: Publiez l'influence et commencez la seconde par une presse sur S1 au temps de l'appropriate.
English translation from French: Publish the influence and start the second by pressing S1 at the time of the appropriate.
So, if you were to create a string by inserting
You are going to create your own satellite assembly, read values from the assembly into your application dynamically, and resize labels where necessary. But before doing that, let's look at some of the tools available to you.
This was inspired by an example of "bad translation" at