在ASP.NET MVC应用程序多国​​语言? [英] Multiple languages in an ASP.NET MVC application?

查看:168
本文介绍了在ASP.NET MVC应用程序多国​​语言?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是支持界面多语言在ASP.NET MVC应用程序的最佳方式?我见过的人使用资源文件的其他应用程序。这仍然是最好的方式?

What is the best way to support multiple languages for the interface in an ASP.NET MVC application? I've seen people use resource files for other applications. Is this still the best way?

推荐答案

如果你使用的是默认视图引擎,然后在视图本地资源的工作。但是,如果你需要一个控制器动作中抢资源字符串,你不能获得当地资源,并有能力使用全球资源。

If you're using the default view engines, then local resources work in the views. However, if you need to grab resource strings within a controller action, you can't get local resources, and have to use global resources.

这是有道理的,当你去想它,因为当地的资源是当地的一个aspx页面,并在控制器,你还没有选择你的看法。

This makes sense when you think about it because local resources are local to an aspx page and in the controller, you haven't even selected your view.

这篇关于在ASP.NET MVC应用程序多国​​语言?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆