I have a WPF application (in English) and I would like to let users to select different languages. I have read some possibilities to change languages in runtime applications
You can follow these steps:
Creating the resource files
Add this file StringResources.xaml to Resources directory. Here is an example:
Close
You can create several files, one for each language.
Adding the resource (Call this when you start your application)
private void SetLanguageDictionary()
{
ResourceDictionary dict = new ResourceDictionary();
switch (Thread.CurrentThread.CurrentCulture.ToString())
{
case "en-US":
dict.Source = new Uri("..\\Resources\\StringResources.xaml", UriKind.Relative);
break;
case "fr-CA":
dict.Source = new Uri("..\\Resources\\StringResources.fr-CA.xaml", UriKind.Relative);
break;
default :
dict.Source = new Uri("..\\Resources\\StringResources.xaml",UriKind.Relative);
break;
}
this.Resources.MergedDictionaries.Add(dict);
}
Using the Resource, like this -
Source: https://www.codeproject.com/Articles/123460/Simplest-Way-to-Implement-Multilingual-WPF-Applica