I am following this thread :-
I want to support multiple languages as originally asked.
I've done everything suggested by Aghilas. However, only the last language that I have added to my App.xaml file actually gets applied. It makes no difference which ResourceDictionary I add at runtime.
Using this extract of the language section in my App.xaml file, only the last language referred to gets used, in this case it's French.
<ResourceDictionary Source="languages/lang-english-uk.xaml" />
<ResourceDictionary Source="languages/lang-english-us.xaml" />
<ResourceDictionary Source="languages/lang-spanish.xaml" />
<ResourceDictionary Source="languages/lang-french.xaml" />
This is the code I call when initialising the application.
private void LoadLanguageResource()
{
ResourceDictionary dict = new ResourceDictionary();
CultureInfo cultInfo = Thread.CurrentThread.CurrentCulture;
switch (cultInfo.TwoLetterISOLanguageName)
{
case "fr":
dict.Source = new Uri("..\\languages\\lang-french.xaml", UriKind.Relative);
break;
case "es":
dict.Source = new Uri("..\\languages\\lang-spanish.xaml", UriKind.Relative);
break;
default:
if (cultInfo.Name.Contains("US"))
{
dict.Source = new Uri("..\\languages\\lang-english-us.xaml", UriKind.Relative);
break;
}
else
{
dict.Source = new Uri("..\\languages\\lang-english-uk.xaml", UriKind.Relative);
break;
}
}
this.Resources.MergedDictionaries.Add(dict);
}