开发者

ASP.NET MVC 2 default resource file not needed

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜