Display Name Localization

Display Name Localization

Old forum URL: forums.lhotka.net/forums/t/10344.aspx

BruderKotlett posted on Thursday, May 05, 2011


I'm trying to localize my buiness object properties, with the Display Attribute.

Like this:

[Display(ResourceType = typeof(Business.BusinessResources), Name = "Text1")]

My Business.BusinessResources is in my Buisness Library. So I got a Business.dll, and a subfolder called "en" with my Business.resources.dll.

- BusinessResources.resx (Public modifier, embeddet resource, PublicResXFileCodeGenerator)

- BusinessResources.en.resx (Public modifier, embeddet resource, PublicResXFileCodeGenerator)

My problem is, that the english translation would't get called, when I set the CurrentCulture an CurrentUICulture to "en". I always get back my german translation.

Can anyone help me with this problem? What I'm doing wrong? Do you need mor information?



RockfordLhotka replied on Thursday, May 05, 2011

I am not sure, as I haven't tried to do this. However, the Display attribute is a standard DataAnnotations attribute, so I suspect there might be an MSDN article on the topic?

BruderKotlett replied on Friday, May 06, 2011

Thank you for your fast reply.

I googled it a long time. But can't find a capable topic or post.

But do you think that I'm on the right way? Have an supfolder called "en" which includes my Business.resources.dll.


RockfordLhotka replied on Friday, May 06, 2011

Usually when creating resource translations, you create all the language-specific resx files in the Resources folder of your project. Visual Studio will create subfolders with resource assemblies automatically when you build the project. You don't create those assemblies yourself - it is a result of the build process.

JonnyBee replied on Sunday, May 08, 2011

I'd just like to add a reference to http://resex.codeplex.com/  .

ResEx is the composite, translation friendly .NET Resource editor.

You'd still need to include the various language resources in your project but Resex makes it a lot easier to translate or find non-translated resources



BruderKotlett replied on Monday, May 09, 2011

Thank you guys. I tried to put my resx-Files into my project and the problem is still the same.

I also used the ResEx Editor, and it says that all my resx-Files are translated correctly.

If I have any further informations on this topic I will let u know.



ajj3085 replied on Monday, May 09, 2011

Is this rich client, or Asp.Net, WebForms or MVC?

BruderKotlett replied on Tuesday, May 10, 2011

I'm using WPF with .NET 4.

BruderKotlett replied on Wednesday, May 11, 2011

Found the problem...

It's because we load our modules (*.dll), which includes the XAML views and everything else, in a shell (the main exe). And the shell standard culture was set to de-DE. So if I set these culture to en, everything works fine.

Kind regards


Copyright (c) Marimer LLC