Hi,
I have set a grid as .Filterable(). The Filter dialogs of the columns are localized (german). In a date columnI can use a calender to set a data for filtering. But the calendar is shown in english. It is possible to show it in the language of the grid?
Peter
5 Answers, 1 is accepted
First, please make sure to review the following articles about localization and globalization with MVC Kendo wrappers:
http://docs.telerik.com/kendo-ui/framework/localization/overview
http://docs.telerik.com/kendo-ui/aspnet-mvc/globalization
You can also use $(document).ready or grid dataBound event to access the generated picker controls and apply custom culture options and formatting patterns using Kendo Globalization:
http://demos.telerik.com/kendo-ui/globalization/index
Please give it a try and let me know if it works for you.
Regards,
Eyup
Telerik

Thanks,
it would be very helpfull if in http://docs.telerik.com/kendo-ui/aspnet-mvc/globalization the files are named in which the code sould be added or changed
But now it works for me with
Step 1 Copy
Step 2+3 Include the bold lines in _Layout.cshtml
<script src="@Url.Content("~/Scripts/kendo.modernizr.custom.js")"></script>
<script src="@Url.Content("~/Scripts/cultures/kendo.culture.de-DE.min.js")"></script>
<script> kendo.culture("de-DE"); </script>
</head>
That was it.
But the code
protected override void Initialize(System.Web.Routing.RequestContext requestContext)
{
Thread.CurrentThread.CurrentCulture =
Thread.CurrentThread.CurrentUICulture =
new CultureInfo(requestContext.HttpContext.Request["my-culture"]);
base.Initialize(requestContext);
}
not work.
But the format for the date column will not changed from US to DE.
So I added in Index.cshtml a Format method. But it will format in US and has no culture argument.
My workaround:
@(Html.Kendo().Grid<Data.myView>()
.Name("grid")
.Columns(columns =>
{
string shortDatePattern = System.Threading.Thread.CurrentThread.CurrentUICulture.DateTimeFormat.ShortDatePattern;
columns.Bound(c => c.Date)
.Format("{0:"+ shortDatePattern + "}")
.Title("Datum");
I assume, the code run on the server? So CurrentThread.CurrentUICulture is from the server?
Peter
requestContext.HttpContext.Request["my-culture"]
get always null.
Peter

it would be very helpfull if in http://docs.telerik.com/kendo-ui/aspnet-mvc/globalization the files are named in which the code sould be added or changed
But now it works for me with
Step 1 Copy
Step 2+3 Include the bold lines in _Layout.cshtml
<script src="@Url.Content("~/Scripts/kendo.modernizr.custom.js")"></script>
<script src="@Url.Content("~/Scripts/cultures/kendo.culture.de-DE.min.js")"></script>
<script> kendo.culture("de-DE"); </script>
</head>
That was it.
But the code
protected override void Initialize(System.Web.Routing.RequestContext requestContext)
{
Thread.CurrentThread.CurrentCulture =
Thread.CurrentThread.CurrentUICulture =
new CultureInfo(requestContext.HttpContext.Request["my-culture"]);
base.Initialize(requestContext);
}
not work.
requestContext.HttpContext.Request["my-culture"]
get always null.
But the format for the Date column will not changed from US to DE.
So I added in Index.cshtml a Format method. But it will format in US and has no culture argument.
My workaround:
@(Html.Kendo().Grid<Data.myView>()
.Name("grid")
.Columns(columns =>
{
string shortDatePattern = System.Threading.Thread.CurrentThread.CurrentUICulture.DateTimeFormat.ShortDatePattern;
columns.Bound(c => c.Date)
.Format("{0:"+ shortDatePattern + "}")
.Title("Datum");
I assume, the code run on the server? So CurrentThread.CurrentUICulture is from the server?
Peter

please delete the first answer. There is no preview button before posting and I can not delete or edit a post.
So I posted it corrected again.

if I activate in the Project Configuration Wizard the checkbox: "Copy Global Resources" the culture folder is in the project but i ~\Scripts\kendo\2016.2.504\cultures\
And I changed the line in _Layout.cshtml to:
<script src="@Url.Content("~/Scripts/kendo/2016.2.504/cultures/kendo.culture.de-DE.min.js")"></script>
If I use CDN Support the line should be:
<script src="@Url.Content("https://kendo.cdn.telerik.com/2016.2.504/js/cultures/kendo.culture.de-DE.min.js")"></script>