Localization Nuts and Bolts

It's good practice to build your applications with localization in mind. The most important thing you can do to prepare for this is to not embed any strings in your code that the user will see. For example you would never use:

MessageBox.Show("Hello World!");

because it embeds the “Hello World!” string in the source code. To make this program a good global citizen, you would create a default resource where the string was identified by a value. For example,

MessageBox.Show((String)resources.GetObject("MyHelloworldResourceString");

In this line, the actual text of the message is not placed in the code but retrieved from a resource that has a string identified as "MyHelloWorldResourceString".

If your default culture ...

Get C# and the .NET Framework: The C++ Perspective now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.