floele
floele

Reputation: 3788

How to globally set the culture in a WPF application (Windows XP)?

I have a WPF application that uses 3rd party controls (like http://navigationpane.codeplex.com) which also provide translated UI (German in particular, which is the default and only language of my app). On Win7, everything is displayed in German as it should be, on WinXP systems (German UI), 3rd party controls still load the English resources.

I have now tried this

Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("de-DE");

and this

Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("de-DE");

and this (which caused that none of the XAML files could be loaded and the application was pretty much corrupt after that):

<UICulture>en-US</UICulture>

and also this

FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag)));

and this:

[assembly: NeutralResourcesLanguageAttribute("de")]

Now I am pretty much out of ideas. Any further suggestions?

Except for UICulture, which does not work at all, I am using all of the methods above combined in App.OnStartup without the desired effect.

Upvotes: 0

Views: 2340

Answers (2)

floele
floele

Reputation: 3788

Problem was actually much simpler, but I completely missed it: The translated resources are located in the satellite *.resources.dll assemblies. On my own machine, these files are copied by the compiler to the output directory (to the respective language code subdirectories), on testing machines (XP in this case), these files were missing though since they have not been added to the setup package.

After adding the *.resources.dll files, all worked as it should.

Upvotes: 1

paparazzo
paparazzo

Reputation: 45106

Try the syntax in the link

Culture

Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture("fr-FR");

Upvotes: 0

Related Questions