redrom
redrom

Reputation: 11642

Kendo Grid - how to dynamically translate top action buttons?

i would like to dynamically translate button below kendo grind (see image below).

enter image description here

And if somebody know how how to translate text for "Drag and drop"..i will be ver glad

Thanks for any help.

EDIT: I tried to do this, but this is not working:

toolbar: [
                { template: kendo.template($("#preparedViewsToolbar").html()) },
                { name: "create" },
                { name: "save" },
                { name: "cancel" }
            ],
            messages: {
                commands: {
                    cancel: "My Cancel changes",
                    canceledit: "My Cancel"
                }
            },

Upvotes: 1

Views: 1418

Answers (1)

OnaBai
OnaBai

Reputation: 40917

If using the latest version of Kendo UI this is pretty easy. Just need to define the messages in an array as in the Grid definition as:

messages: {
    commands: {
        cancel: "My Cancel changes",
        canceledit: "My Cancel",
        create: "My Add new record",
        destroy: "My Delete",
        edit: "My Edit",
        save: "My Save changes",
        select: "My Select",
        update: "My Update"
    }
}

Documentation in here

For Groupable message, you should do:

groupable : {
    messages: {
        empty : "My Drag a column header and drop it here to group by that column"
    }
},

Documentation in here

See it here: http://jsfiddle.net/OnaBai/hb4yhco3/

EDIT: For older versions of Kendo UI as 2014.1.528, you should use the following approach:

toolbar   : [
    { template: kendo.template($("#preparedViewsToolbar").html()) },
    { name: "create", text : "My Add new record" }, 
    { name: "save", text: "My Save changes" },
    { name: "cancel", text: "My Cancel changes" }       
],

The previous JSFiddle example modified here: http://jsfiddle.net/OnaBai/hb4yhco3/3/

Upvotes: 3

Related Questions