Hi!

I am confused. We have written a vb.net wpf app where the user is supposed to change languages of the UI texts by selecting a dropdown list and tehn restarts the app, the selected locale is saved in registry and the below method is called on PAge_LOad

The texts are in resx-files. As it is prepared, we have the english texts in the resource files you edit by right clicking the wpf project and select the resources tab. Then in the project, we have another resx file named "Resources.sv-SE.resx" which contains swedish translations.

In the code, we use the My.Resources.TextName to access the text, and in the xaml we add a xmlns to the My.Resources namespace and access it is as a x:Static.

To change the translations we use this method:

Code:
Private Sub ChangeLocale(locale As String)
        Dim culture = New CultureInfo(locale)
        Thread.CurrentThread.CurrentCulture = culture
        Thread.CurrentThread.CurrentUICulture = culture
        FrameworkElement.LanguageProperty.OverrideMetadata(GetType(FrameworkElement), New FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag)))
    End Sub

The problem is that when calling the method with sv-SE it nworks perfectly, both from xaml and from code the strings change to swedish texts.

But when calling it with en-US it woerks ONLY from code behind and not xaml.

I tried to change the language of windows 8 to en-US and then running the app without the above code it changes everything to english. WHat is wrong here, why doesn't it work when ruynning the above code to change language? Is there something we need to reinitialize? WHat is the difference?

Help me understand...


/Henrik