1.
kendo.cultures[
'en-US'
].calendar.months.names.forEach(
function
(month, index) {
2.
kendo.spreadsheet.DynamicFilter.prototype[month.toLowerCase()] =
function
(value) {
3.
if
(value
instanceof
Date) {
4.
return
value.getMonth() === index;
5.
}
6.
return
false
;
7.
};
8.
});
There doesn't appear to be a culture property that can be set on the spreadsheet kendo config, so I was curious if it's possible to even adjust the culture for the dates in the DynamicFilter to better respect localization?
Secondly, we include a number of culture localization files with our kendo.datpicker.js component so we can internationalize the text for datepicker usages. Unfotunately, adding the en-US culture to the datepicker becomes a problem for the spreadsheet which takes a dependency on datepicker. Looking at the code below from kendo.core.js, you can see that there is a function (called on file load) which will take in a culture (line 13 shows it's invoked with en-US) and add the calendar property to that particular culture. This calendar property is only used by the spreadsheet component, which assumes en-US, likely because this kendo.core.js only does this for en-US. It appears that the work-around would be to simply have the spreadsheet use the calendar's.standard property instead of assuming the kendo.cultures dictionary won't be updated between kendo.core.js load and the load of the kendo.web.js for spreadsheets. This could be achieved by exposing a property on spreadsheet for datePickerCulture which falls back to en-US by default. In any case, this is what drives the DynamicFilter property code for the spreadsheet and when we load a new culture for en-US, we lose the calendar property. We've worked around this by loading the culture files for the localizations we want, calling kendo.culture('en-US') to get the calendar property, then loading the kendo.spreadsheet.js with it's dependencies. Is this the right approach, or am I missing some instructions?
01.
kendo.culture =
function
(cultureName) {
02.
var
cultures = kendo.cultures, culture;
03.
if
(cultureName !== undefined) {
04.
culture = findCulture(cultureName) || cultures[EN];
05.
culture.calendar = culture.calendars.standard;
06.
cultures.current = culture;
07.
}
else
{
08.
return
cultures.current;
09.
}
10.
};
11.
kendo.findCulture = findCulture;
12.
kendo.getCulture = getCulture;
13.
kendo.culture(EN);