views:

667

answers:

2

I am, for lack of a better word, a newbie to Localization and resource files. I am trying to localize an application I am working on and I want to do it using resource files and satellite assemblies, but I can't figure out how to do it correctly. Here is what I have so far:

In my project directory: I created the files LanguageText.resx and LanguageText.nl.resx

In my project/bin directory: I created the folder "nl"

In my project/bin/nl directory: I used ResGen.exe to create LanguageText.nl.resources file from LanguageText.nl.resx file, then I used AL.exe to create the project.resources.dll file. That .dll file is in the bin/nl folder. It assembled ok and now I have nl/project.resources.dll in my project/bin/debug folder as well.

My problem is that I apparently do not have a neutral language file or resource embedded in my program, but I can't find any info on how to do that. The only info I can find about embedding resources in this manner is related to satellite assemblies. How do I embed the neutral language resource?

Any help or direction is appreciated.

Thanks, Mike

A: 

The fallback resources should be placed in LanguageText.dll in the bin folder. Alternatively, you may add an System.Resources.NeutralResourcesLanguageAttribute attribute to the LanguageText.dll assembly, and specify a default culture used if the culture is invariant, or there is no match for a given culture.

Generate the nl assembly, call it LanguageText.resources.dll, place in bin/nl folder.

Verify that this works, by setting the culture on your thread and use a ResourceManager to retrieve resources.

baretta
A: 

You can do it with the help of AssemblyInfo. Go to AssemblyInfo.cs and add the attribute [assembly: NeutralResourcesLanguageAttribute("en-US",UltimateResourceFallbackLocation.Satellite)] Make sure to add using statement using System.Resources; at the top. The above line indicates that the neutral resource language of your assembly is 'en-US' and this is a Satellite assembly.

Hope this will help you!

Neo