morcillo
morcillo

Reputation: 1109

Change language of my wpf application

I've been using .resx file to show the names of my buttons, labels and dynamically created components.

How can I add a combobox to choose which .resx file to use?

Imagine this. The selected language by default is English, but the user is a Swedish person who doesn't know anything about english. So he would choose from the combobox his language, swedish, which would load the swedish .resx file, that contains the exact same names that the other languages but its value, or content, I don't know how to call it, so all the text in my application would change its language.

Could anyone help me with that?

Upvotes: 2

Views: 1676

Answers (1)

Sugrue
Sugrue

Reputation: 3739

Use the combobox to change the Culture of the current thread:

Thread.CurrentThread.CurrentUICulture = new CultureInfo("en");

or

Thread.CurrentThread.CurrentUICulture = new CultureInfo("sv-SE");

Upvotes: 3

Related Questions