Code Internationalization

This is my first article on Internationalization. This is one topic in the software development, which gets mostly ignored.

This is a very simple windows application example for localizing the application. Visual studio .NET makes it pretty simple to create localized applications and manage them.

In this example, Ive used MSAgent control just to make it less boring. It says Hello World in different languages.

The following steps would help creating a windows forms application for different locales.

  1. Create the windows form with Visual studio .NET

  2. Change the localizable property to TRUE.

  3. Set the language property of the form to the language for localization. Youll see that a new .resx file has been created with the name of the form for that locale.

  4. Change the controls name in the given language.

  5. Set the current locale for the application. In this example, it is done in the constructor of the form with this piece of code.

    System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("fr-FR");

    With this piece of code, the resource manager will look for the French version of the form at the runtime. Ill explain Resource manager in the next few articles.

  6. Repeat steps 3 ,4 for any other language for localization. In the real time application development, these forms can be sent separately to linguists for correct language. The translators can use a tool WinRes (This comes with .NET or can be downloaded separately) for changing the text of the forms without affecting the code in the forms.

  7. Now, run the application. It will automatically pick the French version of the form.

  8. To change it to Spanish, just change the culture code to es-AR.

This is just the starting. In the future articles, I intend to introduce people to the Internationalization and then, involve them in developing a framework for creation of International applications.

Up Next
    Ebook Download
    View all
    View all