How to localize Silverlight Application with Resource File

Having your Silverlight application in multiple language is pretty the same as ASP.NET localization mechanism.

The first step is to create a new Resources File for your default language (English is the default one). You will find the Resources File template in the “Add New Item” under General tab.

Add a Resources File in Visual Studio 2010

Once it’s done, you can repeat that task for other language. Like with ASP.NET, you need to change the file name to have the two letters acronym of the language.

Two Resources Files

The second part is to add string into it. Simply double click the file and add Name and value for the string you want to be localized.

The last step is to use those values. To do it, simply use the code that has been generated by Visual Studio under the resource file (.designer).

var errorCaption = ErrorMessages.CaptionEmpty;

And that’s it, you have now inside errorCaption your localized string.

If you like my article, think to buy my annual book, professionally edited by a proofreader. directly from me or on Amazon. I also wrote a TypeScript book called Holistic TypeScript

1 thought on “How to localize Silverlight Application with Resource File

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.