# Localization

The Grid provides options for localizing its user interface by utilizing the available Resources messages as well as providing custom messages as part of its configuration.

## Getting Started

To use the community-sources Resources files, override the executing context and set the server-side culture. This causes the ASP.NET MVC Grid to use the matching Resource file messages and localize them accordingly. In case of missing messages, you can update the Resources file or include the message in the configuration of the grid.

1. Add the `Microsoft.AspNetCore.Mvc.Filters` and `System.Globalization` to the controller using namespaces:

   ```C#
   using Microsoft.AspNetCore.Mvc.Filters;
   using System.Globalization;
   ```

2. Override the default thread culture and the current UI culture.

   ```C#
   public override void OnActionExecuting(ActionExecutingContext context)
   {
       CultureInfo.DefaultThreadCurrentCulture = CultureInfo.DefaultThreadCurrentUICulture = new CultureInfo("fr-FR");

       base.OnActionExecuting(context);
   }
   ```

3. Match the client-side culture. By including the Kendo UI culture scripts, the number formats, the week and month names, the date and time formats, and so on will match the server-side culture and prevent validation errors. The culture scripts are generated from the Windows 10 and .NET 4.7 server-side culture definitions and match them by design.

   ```Razor HtmlHelper
       <script src="https://cdn.jsdelivr.net/npm/@@progress/kendo-ui@2026.4.1111/js/cultures/kendo.culture.fr-FR.min.js"></script>
       

       <script>kendo.culture("fr-FR");</script>

       @(Html.Kendo().Grid<OrderViewModel>()
           /* grid definition */
       )
   ```

## Toolbar Messages

The following example demonstrates how to customize the text of the Grid toolbar commands by using the `Toolbar.[Command].Text()` method.

```Razor HtmlHelper
    @(Html.Kendo().Grid<AspNetCoreGrid.Models.OrderViewModel>()
        .ToolBar(tools=>
        {
            tools.Pdf().Text("Custom PDF button text");
            tools.Excel().Text("Custom Excel button text");
            tools.Save()
                .SaveText("Custom Save Changes button text")
                .CancelText("Discard Changes");
            tools.Create().Text("Custom Create button text");
        })
```

When the toolbar contains the `Save` command, use `SaveText()` and `CancelText()` to customize the Save Changes and Cancel Changes buttons generated by that command. In TagHelpers, configure the buttons separately with `name="save"` and `name="cancel"`.

## Menu Messages

The following example demonstrates how to implement the message translation of the column menu in the Grid by using the `ColumnMenu.Messages()` method.

```Razor HtmlHelper
    .ColumnMenu(colMenu=>colMenu.Messages(messages=> {
            messages.SortAscending("Custom Sort Asc Message");
            messages.SortDescending("Custom Sort Desc Message");
            messages.Columns("Custom Columns Message");
            messages.Filter("Custom Column Filter message");
            messages.Lock("Custom Column Lock message");
        })
    )
```

## Command Messages

The following example demonstrates how to implement the translation of the column command messages in the Grid by using the command `Columns.[Command].Text()` method.

```Razor HtmlHelper
    .Columns(columns =>
    {
        columns.Bound(f => f.OrderID).Width(200);
        columns.Bound(f => f.ShipCountry).Width(200);
        columns.Command(command =>
        {
            command.Edit().Text("Custom Edit button text");
            command.Destroy().Text("Custom Destroy button text");
        });
    })
```

## Filter Messages

The following example demonstrates how to implement the translations of the filter menu and operator messages in the Grid by using the `Filterable.Messages()` and `Filterable.Operators.For[Type]()` methods.

```Razor HtmlHelper
    .Filterable(filterable => {
        filterable.Messages(messages =>
        {
            messages.Info("My Info");
            messages.Clear("My Clear");
            messages.Or("My Or");
            messages.And("My and");
            messages.IsTrue("My Custom True");
            messages.Operator("my custom operator message");
            /* and others */
        });
        filterable.Operators(op => {
            op.ForString(strop=> {
                strop.Clear(); // default filter operator
                strop.Contains("My Contains");
            });
        });
    })
```

## Group Header Messages

The following example demonstrates how to implement the translation for the group header messages in the Grid by using the `Groupable.Messages.Empty()` method.

```Razor HtmlHelper
    .Groupable(groupable=> {
        groupable.Messages(messages =>
        {
            messages.Empty("My Drag Here to group by column message");
        });
    })
```

## Pager Messages

The following example demonstrates how to implement the translations of the pager messages in the Grid. For more information, refer to the [`messages`](https://docs.telerik.com/kendo-ui/api/ui/pager/configuration/messages) API reference.

```Razor HtmlHelper
    .Pageable(pageable=> {
        pageable.Refresh(true);
        pageable.Messages(messages => {
            messages.Refresh("My Refresh");
            messages.Next("My Next");
            messages.Last("My Last");
            messages.Display("My {0} - {1} of {2} items"); // {0} is the index of the first record on the page, {1} - the index of the last
            /* and others */
        });
    })
```

## See Also

* [Localization Support by the Grid HtmlHelper for ASP.NET MVC (Demo)](https://demos.telerik.com/aspnet-mvc/grid/globalization)
* [RTL Support by the Grid HtmlHelper for ASP.NET MVC (Demo)](https://demos.telerik.com/aspnet-mvc/grid/right-to-left-support)
* [Globalization in Telerik UI for ASP.NET MVC](https://www.telerik.com/aspnet-mvc/documentation/globalization/overview)
