Sunday, August 26, 2007

How to test localized application?

You finished writing World-Ready application. It detects current system culture, or possibly, UI culture, or, even Region and change it's layout language to language, detected with those methods. Now, you want to test it on different locales. What to do? You can go to test PC or, if you're advanced user, install virtual PC images and test the application, while changing Regional and Language Options for each of locale, you want to test. Pretty complicated, especially,  when you want to change UI culture - MUI application requires restart. How to make it easier?

image

You can try tinny test application, I wrote to perform such task. All you have to do is open your target application via LocTester (or just drop the executable into it and play with cultures to test localization support. Here the screenshot of LocTester

image

And small video, that demonstrates the way you'll use it.

Now a little bit about localization in general. First  of all, we have to decide what we want from localization. If all you want is locale-specific dates, currencies or formats, you, probably have to use CultureInfo.CurrentCulture class, if all you want is detect the geographical location of end users, use RegionInfo.CurrentRegion (it's derived from CurrentCulture). In case, you do not need to change formats, but you want to localize user interface for those users, who has Start button on other language, use CurrentCulture.CurrentUICulture class. How to use it? Simple

 

if (CultureInfo.CurrentUICulture.TwoLetterISOLanguageName.Equals("fr"))

{


this.ChangeUICulture("fr");

}


else if (CultureInfo.CurrentUICulture.TwoLetterISOLanguageName.Equals("de"))

{


this.ChangeUICulture("de");

}


else if (CultureInfo.CurrentUICulture.TwoLetterISOLanguageName.Equals("it"))

{


this.ChangeUICulture("it");

}







Now test it with LocTester to see results. You can compare them later, by changing system locale :)



Download LocTester Binaries >>



Download LocTester Source >>

No comments: