带有语言属性

时间:2016-09-29 12:07:39

标签: asp.net-mvc asp.net-mvc-4 internationalization html.actionlink

我认为这很容易,但我无法弄明白。

我有自定义路线

routes.MapRoute(
                name: "DefaultLocalized",
                url: "{language}/{controller}/{action}/{id}",
                defaults: new { language = "EN", controller = "Home", action = "Index", id = UrlParameter.Optional }
            );

在控制器中我有

protected override void Initialize(System.Web.Routing.RequestContext requestContext)
        {
            base.Initialize(requestContext);
            ViewBag.language = Internationalization.SetCultureFromUrl(requestContext, "EN");
        }

问题是,如何在@Html.ActionLink中指定语言属性?

0 个答案:

没有答案