如何本地化kendo网格ASP.NET

时间:2016-11-07 17:18:58

标签: localization grid kendo-grid kendo-asp.net-mvc

我想本地化我的kendo网格消息,例如"每页的项目","列"。我在用户的个人资料中更改了语言。如何将用户的值传递给剑道?

1 个答案:

答案 0 :(得分:1)

这是我最近自己做的事情我在布局页面上使用了以下方法:

<!-- Load kendo language and culture scripts -->
@{
    var languageDev = UserManager.GetUserAsync(ContextAccessor.HttpContext.User).Result.UserLanguageCode;
    switch (languageDev)
    {
        case "es":
        {
            <script src="~/lib/kendo-ui/js/cultures/kendo.culture.es.min.js" type="text/javascript"></script>
            <script src="~/lib/kendo-ui/js/messages/kendo.messages.es-ES.min.js" type="text/javascript"></script>
            break;
        }
        case "zh":
        {
            <script src="~/lib/kendo-ui/js/cultures/kendo.culture.zh.min.js" type="text/javascript"></script>
            <script src="~/lib/kendo-ui/js/messages/kendo.messages.zh-CN.min.js" type="text/javascript"></script>
            break;
        }
        case "ru":
        {
            <script src="~/lib/kendo-ui/js/cultures/kendo.culture.ru.min.js" type="text/javascript"></script>
            <script src="~/lib/kendo-ui/js/messages/kendo.messages.ru-RU.min.js" type="text/javascript"></script>
            break;
        }
        default:
        {
            <script src="~/lib/kendo-ui/js/cultures/kendo.culture.en.min.js" type="text/javascript"></script>
            <script src="~/lib/kendo-ui/js/messages/kendo.messages.en-GB.min.js" type="text/javascript"></script>
            break;
        }
    }
    <script type="text/javascript">kendo.culture("@languageDev");</script>
}