customize language grid.mvc

818 Views Asked by At

I am using grid.mvc in my application. I changed the language of grid to Persian for some of items like this:

GridMvc.lang.fa = {
filterTypeLabel: "نوع فیلتر: ",
filterValueLabel: "مقدار فیلتر:",
applyFilterButtonText: "اعمال",
filterSelectTypes: {
    Equals: "برابر با",
    StartsWith: "شروع با",
    Contains: "شامل",
    EndsWith: "پایان با",
    GreaterThan: "بزرگتر از",
    LessThan: "کوچکتر از"
},
code: 'fa',
boolTrueLabel: "بله",
boolFalseLabel: "خیر",
clearFilterLabel: "حذف فیلتر"};

But I can't change expressions "There are no items to display" when there is no item to display in grid and "Filter this column" when hover in filter icon.
How can I change these expressions to my favorite language?

1

There are 1 best solutions below

0
On

This comes a bit late so I suppose you'll already have found the solution, but here it is anyway in case anybody else encounters the same issue. You can just use a resource file (let's call it "GridModule", for instance) in which you'll define "EmptyText" and then declare your grid as follows :

@Html.Grid(Model).Columns(col =>
{
    col.Add(...)
}).EmptyText(GridModule.EmptyText).Sortable(true).Filterable(true).[...]

And you should then get the empty text of your choice.