我正在尝试开发具有选择语言功能的 MVC3(剃刀)应用程序。
使用以下视图作为_Layout.cshtml
_SelectCulture的局部视图
<text>
@Html.ActionLink("English", "SetCulture", new { controller = "Culture", culture = "en-GB" })
|
@Html.ActionLink("Welsh", "SetCulture", new { controller = "Culture", culture = "cy-GB" })
</text>
<div>
@System.Threading.Thread.CurrentThread.CurrentUICulture.ToString()
</div>
文化控制器
public ActionResult SetCulture(string culture)
{
System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo(culture);
System.Threading.Thread.CurrentThread.CurrentCulture = ci;
System.Threading.Thread.CurrentThread.CurrentUICulture = ci;
return RedirectToAction("Index", "Home");
}
但它仍然没有改变语言。
请提供任何帮助。
谢谢