#1,132 – Localization XIII – Verifying Localized Content

Once you integrate localized content back into your application, you’ll want to verify that the new content looks correct.  You could verify the content by running your application on a system having the target culture (e.g. French).  You can also just override the local culture information at run-time, setting it to the target culture for testing purposes.

To override the culture at run-time, you set the CurrentUICulture property of the current thread.  Below, we change the current UI culture at app startup so that we can test localization for the fr-FR (French/France) culture.  We also override metadata for the Language property to force user interface controls to pick up the current culture (rather than UI culture).

    public partial class App : Application
    {
        public App()
        {
            Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("fr-FR");
            FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata(
                        XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag)));
        }
    }

1132-001

Advertisement