I have been trying to get culture specific resources to work on an asp.net m开发者_如何学运维vc 3 application.
If I have a LanguageResources.resx and a LanguageResources.en-UK.resx in my App_GlobalResources folder then I get an error "The namespace 'Resources' already contains a definition for 'LanguageResources'"
This is the end of a long line of issues that I have had with trying to get culture specific resources to work. I must say, I'm not impressed with the documentation Microsoft provide for using this feature.
I'm considering using a database table to store my culture specific strings instead, then I can just build a dictionary of all the values that will be available to my controller and views.
Has anyone else made such a decision, or have any direct knowledge on performance issues related to using a database for culture specific strings?
Has anyone else given up on resources too?
I must admit, I tried to reproduce your defect and I was successful. It looks like, Visual Studio generates additional class when you add something.en-UK.resx. Strange. It should not allow you to add anything like this in the first place for there is no such culture.
How to resolve the problem? Just add LanguageResources.en-GB.resx and delete
LanguageResources.en-GB.resx. That helps.
I would not use database for storing language-related resources, unless they are changing very frequently or must be entered by end users (i.e. there are some kind of templates).
Using the database hurts Localizability and requires much effort. It is hard to design correctly (I have seen a lot of mistakes in that area). Don't go that road unless you really have to.
精彩评论