Problem using different resources

Dec 3, 2012 at 8:33 AM

Hello,

I created a new MVVM light application and experience some problems with
WPF localization extension in Visual Studio 2010 Premium.

In the project i created a map called "Lang" and in that map I created "Lang.resx" and "Lang.en-US.resx". Lang.resx has acces modifier "internal" while Lang.en-US has "no code generated".

Now in the main window I put:

xmlns:lex="http://wpflocalizeextension.codeplex.com"
        lex:LocalizeDictionary.DesignCulture="en-US"
        lex:ResxLocalizationProvider.DefaultAssembly="VisitorRegistration"
        lex:ResxLocalizationProvider.DefaultDictionary="Lang"

in the <Window> tag.

The problem is: it completely ignores the en-US design culture and only uses the resources from Lang.resx. In my App.xaml.cs I use the line "LocalizeDictionary.Instance.Culture = CultureInfo.GetCultureInfo("en-US");" in static App(){} to set the culture to "en-US" but when I run it, it still only uses the resources from "Lang.resx".

Any help would be appreciated, I really can't figure it out on my own. Thanks.

Coordinator
Dec 3, 2012 at 9:55 AM
Edited Dec 3, 2012 at 9:57 AM

Hi Dovogja,

its normal that only the main file (Lang.resx) has a code generator. The other files (en-US, fr, etc.) will be linked during compilation.

Is the Resource and the Window in the same Assembly? (VisitorRegistration)
If not, please change the access modifier to public.

How does your assembly.cs looks like?

Cheers, Bernhard

Dec 3, 2012 at 10:20 AM

Hi Bernhard,

Thank you so much for your reply, I found the solution in my AssemblyInfo.cs.

It contained the line:

[assembly: NeutralResourcesLanguage("en-US",
UltimateResourceFallbackLocation.MainAssembly)]

When I remove this everything seems to work fine, now it looks in the
Lang.en-US.resx the way i expect it to do.

Thank you for your help!

Cheers, Dovogja

Coordinator
Dec 3, 2012 at 10:22 AM
Edited Dec 3, 2012 at 10:27 AM

Yep, I expected this line in the assembly.cs... bad default settings :)

Hope everything works now!
If you need something just ask.

Cheers!

http://wpflocalizeextension.codeplex.com/wikipage?title=NeutralResourcesLanguage%20in%20Assembly%20Manifest