失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > ASP.NET MVC资源文件多语言实现方式

ASP.NET MVC资源文件多语言实现方式

时间:2018-08-31 18:59:57

相关推荐

ASP.NET MVC资源文件多语言实现方式

1、项目结构

2、代码

using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.Mvc;using System.Collections;namespace MvcTest.Controllers{public class HomeController : Controller{public ActionResult Index(){ViewBag.Welcome = Resources.Message.Welcome;return View();}}}

@ViewBag.Welcome

Web.config

指定UI所要显示的语系为“en-US”

<system.web><globalization uiCulture="en-US"/></system.web>

让网站依据浏览器的语系设定自动判断响应语系的版本

<system.web><globalization culture="auto" uiCulture="auto" enableClientBasedCulture="true"/></system.web>

如果觉得《ASP.NET MVC资源文件多语言实现方式》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。