ASP.NET MVC 3:- 使用数据库而不是资源文件作为本地化存储
我们已在数据库中本地化了字符串,并想知道是否扩展 ASP.NET 资源提供程序模型将与 ASP.NET MVC 3 Razor 视图引擎一起使用。
请告诉我,一旦我们扩展了 ASP.NET 资源提供程序模型,ASP.NET MVC 3 Razor 视图引擎是否支持从数据库检索本地化字符串。或者它仅适用于经典 ASP.NET 而不适用于 ASP.NET MVC。
谢谢萨蒂亚普拉
卡什 J
We have localised strings in the database and would like to know if extending the ASP.NET Resource Provider Model would work with the ASP.NET MVC 3 Razor view engine.
Kindly let me know if ASP.NET MVC 3 Razor view engine supports retrieving localized strings from the database once we have extended the ASP.NET Resource Provider model. Or does it work only with Classic ASP.NET and not with ASP.NET MVC.
Thank you
Satyaprakash J
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
到目前为止我发现的最干净的解决方案是: http://www.codeproject.com/Tips/514321/A-Simple-and-Effective-Way-to-Localize-ASP-Net-MVC。
欢迎评论/反馈。
编辑1:根据评论,我添加了代码示例并使用链接作为参考。
我创建了一个 customDataAnnotationsProvider 类:
然后我在 Global.asax 中的 ApplicationStart 上引用了自定义提供程序
您不必更改模型,并且可以使用 Display 注释:
The cleanest solution I've found so far is: http://www.codeproject.com/Tips/514321/A-Simple-and-Effective-Way-to-Localize-ASP-Net-MVC.
Comments/Feedback are welcomed.
Edit 1: Based on comments, I added code examples and used the link as reference.
I created a customDataAnnotationsProvider class:
Then I referenced the custom provider on ApplicationStart in Global.asax
You do not have to change your model and can use the Display annotation:
你很幸运,因为 Rick 已经为你做到了!
西风.ASP.NET 全球化数据驱动资源提供程序
You are in luck because Rick have already done it for you!
Westwind.Globalization Data Driven Resource Provider for ASP.NET