Localizing a Windows Form

Always have a question mark about how to do localization for a windows Form application. So taken this challenge and here the steps goes

1. Create a Windows Forms Project.

2. Set the Localizable property of Form to True.

3. A resx file is created per window form.

4. Add Control Name.Text as Name and its value to “My Form”. The convention of the name is Control Name.Property Name

5. A resource file generated per language i.e. if you would like to support 5 languages then need to have 5 resx file. Each one following MS specified naming convention.

6. Initializes the ResourceManager
ResourceManager resMgr = new ResourceManager(,
Here while providing the name of the form provide the fully qualified name of the form class name i.e. with namespace.

7. Initializes the Culture based on the language selected, assumming there is config file where the locale is set
locale = ConfigurationManager.AppSettings[“LOCALE”];
if (locale == “DEFAULT”)
Thread.CurrentThread.CurrentUICulture = CultureInfo.InstalledUICulture;
Thread.CurrentThread.CurrentUICulture = new CultureInfo(locale);

8. Now use the ResourceManager to read the read the corresponding culture string

this.Text = resMgr.GetString(“<Control Name>. <Property Name>”, Thread.CurrentThread.CurrentUICulture);
The above set the Text property of the Form to the corresponding localized string.

Yuppppieeeeeeeee the form is localized.

The namespaces to refer
using System.Threading;
using System.Globalization;
using System.Resources;

The Links for help
Link 1


Windows Form Life Cycle

A link to Windows Form Life Cycle