Reputation: 83
I want to change culture for a kendo numericTextBox. For example from en-EN in ro-RO, so that the text from the upArrow would be translated in Romanian. I tried setting culture in the kendo.numericTextBox.js, but it does not work. Do you have any ideas?
Upvotes: 2
Views: 3298
Reputation: 1570
Assume t is the culture, then you can change from current culture to other with this script. But note, the 1st change may be problematic if you use f.e. ASP.NET MVC, since the CurrentCulture and the primary kendo culture must always match.
var t = e.sender.text();
$(".k-widget.k-datepicker .k-input").each(function(i, v) {
var c = $(v).data("kendoDatePicker");
var origValue = c.value();
c.options.culture = t;
c.value(origValue);
});
$(".k-widget.k-datetimepicker .k-input").each(function (i, v) {
var c = $(v).data("kendoDateTimePicker");
var origValue = c.value();
c.options.culture = t;
c.value(origValue);
});
$(".k-widget.k-timepicker .k-input").each(function (i, v) {
var c = $(v).data("kendoTimePicker");
var origValue = c.value();
c.options.culture = t;
c.value(origValue);
});
$(".k-widget.k-numerictextbox .k-input[data-role='numerictextbox']").each(function (i, v) {
var c = $(v).data("kendoNumericTextBox");
var origValue = c.value();
c.options.culture = t;
c.value(origValue);
});
kendo.culture(t);
Upvotes: 0
Reputation: 40887
First you need to include the culture file:
<script src="/js/cultures/kendo.culture.ro-RO.min.js"></script>
Then if you want it only for one NumericTextBox
set culture
to ro-RO
:
$("#number").kendoNumericTextBox({
culture: "ro-RO",
format : "c",
value : 123.45
});
If you want to set all, then use kendo.culture("ro-RO");
:
kendo.culture("ro-RO");
$("#number1").kendoNumericTextBox({
format : "c",
value : 123.45
});
$("#number2").kendoNumericTextBox({
format : "c",
value : 123.45
});
For changing the text for increase and decrease value you can use:
$("#number").kendoNumericTextBox({
culture : "ro-RO",
format : "c",
value : 123.45,
upArrowText : "Creșterea valorii",
downArrowText: "Scăderea valorii"
});
Upvotes: 4