C#C
C#16mo ago
HiveMind

Change language at runtime in WPF

Hi! I have a set of *.resx files with translations and they work fine when I start the app. If I start on computer with english system, it chooses english translation, if I choose spanish system, it loads spanish translation, etc. But how can I change it at runtime?

Currently, I'm doing it in this way:
C#
<Label FontSize="10" Foreground="Gray" Margin="0,10,0,0" Name="languageLabel" Content="{x:Static p:LanguageVersion.Settings_Language}"/>

And I guess, I will need to change every x:Static, but I'm ready for this sacrifice.

I'm trying to change language in this manner:
C#
Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture("pl");
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("pl");

But it doesn't do anything
Was this page helpful?