This article is compatible with the latest version of Silverlight.
I highly recommend that all .NET applications leverage Microsoft’s internationalization framework, regardless of whether or not there is a current business requirement for it. The main reasons are:
- It is not all that difficult or time consuming to set an application up for internationalization at the onset of development.
- It is much more difficult to internationalize an app after the fact, and no fun hunting through thousands of lines of code for every bit of text that appears on the screen. It is also not fun having to revisit the code every time QA finds a string that was missed…it is basically a testing and bug fixing nightmare.
- If best practices are followed, it encourages a consistent approach to how resources (strings, dates, etc.) are handled throughout a project. Consistency is always a good thing.
- It encourages use of the DRY Principle (Don’t Repeat Yourself).
Now let me just elaborate a bit on the last point. Let’s say, for example, that you are developing an application that has similarities to Microsoft Outlook. You may have the string ‘New’ that appears in more than one place.
The File menu:
The toolbar:
What you do not want to do is have the string ‘New’ appear twice in your code. If you do, you have violated the DRY Principle. What if one day the UI designer comes by and says “can we change New to Add?” Wouldn’t it be nice to make the change in one place? Think of all the time you use terms like Save, OK and Cancel in your app. Hmm.
What I try to do is having hard-coded strings anywhere in my code. I prefer to use constants, and in this case, draw the string from a .resx file.