asp.net mvc where to set default culture?

限于喜欢 提交于 2019-12-05 12:59:23

Try it setting in web.config

<configuration>
    <system.web>
        <globalization uiCulture="en-GB" culture="en-GB" />
    </system.web>
</configuration>

this is a more generic way to set the culture...

Dragon

You can set culture in Application_AcquireRequestState:

protected void Application_AcquireRequestState(object sender, EventArgs e)
{
    // A Cookie
    string cookie = HttpContext.Current.Request.Cookies["culture"].Value;

    Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo(cookie);
    Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo(cookie);
}

You can also visit this link

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!