'Localize Prism 4 Modules with .resx files

I'm working on a modularised Prism application. After some localized WPF clients with resx files (localized.resx, localized.de.resx etc.), i thought i could adapt this technique to my prism modules. But the module always takes the default resx.

Any suggestions?

Thanks in advance



Solution 1:[1]

Sorry but it's not easy to explain this with a short message. So I wrote a really simple prism project with a working solution.

Try to download this example

Solution 2:[2]

Actually its pretty easy, just make sure to force your localization inside CreateShell() inside app.xaml.cs like this:

protected override Window CreateShell()
        {
            SetLocalization();
            return Container.Resolve<MainWindow>();
        }

the SetLocalization() method can be like this :

private void LoadLocalizationFromSettings()
{
Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-us");
            
            //set pc default localization to be used in the XAML gui
            FrameworkElement.LanguageProperty.OverrideMetadata(
                     typeof(FrameworkElement),
                     new FrameworkPropertyMetadata("en-us")));
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 pluka
Solution 2 Mosaab Boumerdas