开发者

ASP.NET MVC 2 default resource file not needed

开发者 https://www.devze.com 2023-01-11 04:54 出处:网络
I use resource files throughout App_GlobalResources. Why do I need to have the default resource file? If I have MyResFile.resx (default file) and MyResFile.en-us.resx it\'s all fine.

I use resource files throughout App_GlobalResources.

Why do I need to have the default resource file?

If I have MyResFile.resx (default file) and MyResFile.en-us.resx it's all fine.

If I remove the default file, 开发者_开发问答stuff like <%: Resources.MyResFile.Key%> from view or Resources.MyResFile.Key; from controller does not work, telling me Resources does not exist in current context.

But I really don't want to have to keep 2 up to date files, I specify my culture in web.config, and thus know it will exist.

Any solutions?


You need the default resource file for when the server can't find a resource file for the requested culture.


If the texts in your default resource file are in American English, you do not need the MyResFile.en-us.resx file at all.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号