1

在剑道网格的页脚中,它显示“每页项目”和“项目”如何将它们放入资源文件中进行本地化。谢谢,

4

3 回答 3

4

您可以按如下方式本地化或修改文本

 pageable: {
  messages: {
    display: "{0} - {1} of {2} items", //{0} is the index of the first record on the page, {1} - index of the last record on the page, {2} is the total amount of records
    empty: "No items to display",
    page: "Page",
    of: "of {0}", //{0} is total amount of pages
    itemsPerPage: "items per page",
    first: "Go to the first page",
    previous: "Go to the previous page",
    next: "Go to the next page",
    last: "Go to the last page",
    refresh: "Refresh"
   }
}

参考http://demos.telerik.com/kendo-ui/grid/localization

于 2015-05-05T14:31:38.803 回答
3

当您构建网格并设置其属性(例如过滤、列名等)时,您可以将自定义剑道网格消息覆盖为:

 gridbuilder.Pageable().Messages(m => {
                     m.Display("{0} - {1} of {2} My customized items");
                     m.Empty("No result found custom msg");
                     })

Display 和 Empty 的内容、每页的项目...等属性然后可以轻松地移动到资源文件并从资源文件中读取。

于 2013-06-26T18:53:35.803 回答
2

如果您不想更改实际的寻呼机消息,那么利用 Kendo 文化 javascript 文件将是一种更好的方法。

这些文件具有本地化消息,您只需通过布局页面设置一次。

下面的例子:

@using Microsoft.AspNetCore.Http;
@model Microsoft.AspNetCore.Http.HttpContext

@inject UserManager<User> UserManager
@inject IHttpContextAccessor ContextAccessor

<!-- 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>
}

查看可用的文化列表:https ://cdnjs.com/libraries/kendo-ui-core

于 2017-07-12T08:33:59.987 回答