New to Telerik UI for ASP.NET MVC? Download free 30-day trial

Telerik UI for ASP.NET MVC Localization

Localization is the process of adapting software to meet the requirements of local markets and different languages.

You can change the messages that are displayed in the Telerik UI for ASP.NET MVC helpers by including an additional script file in the document.

Localization Files

Officially, the Telerik UI for ASP.NET MVC components support only the English language. The community contributes to translating the messages to other languages by adding new messages JavaScript files and updating the existing ones in the Kendo UI Core repository.

To display messages in different languages, Telerik UI for ASP.NET MVC uses localization (resource) files, for example, Messages.es-ES.resx. The localization files are generated from the messages JavaScript files.

You can find the resource files in the Telerik UI source zip bundle:

  1. Log in to your Telerik account.

  2. Go to the Telerik UI for ASP.NET MVC download page and download the telerik.ui.for.aspnetmvc.2024.4.1112.commercial-source.zip file.

  3. Extract the archive and navigate to the \src\Kendo.Mvc\Kendo.Mvc\Resources\ folder that contains the resource files.

Changes made to the messages files through community contribution will be reflected in the Telerik UI for ASP.NET MVC release that follows that contribution. Refer to the section on contributing.

Setting the Current Language

The culture that is used for the localization messages in Telerik UI for ASP.NET MVC is determined by the CurrentUICulture, not by the CurrentCulture property. By default, if CurrentUICulture is not supported, the Telerik UI for ASP.NET MVC helpers will display their messages in American English (en-US). If CurrentUICulture is set from code or from the web.config file, Telerik UI for ASP.NET MVC will use localized user interface messages.

Customizing the Localized Messages

Telerik UI for ASP.NET MVC uses satellite assemblies to support localization (user interface messages localized for a set of cultures). To change the provided localization messages, you have to build a custom Kendo.Mvc.dll version because Kendo.Mvc.dll is a strongly named assembly and its private key is not shipped as part of the distribution.

To update the provided localization messages in Telerik UI for ASP.NET MVC:

  1. Open the \src\Kendo.Mvc\Kendo.Mvc.csproj Visual Studio project. The \src directory is available only with the commercial version of Telerik UI for ASP.NET MVC.
  2. Locate the Resources directory in the solution explorer. It contains the resource files for the supported cultures.

    UI for ASP.NET MVC Resources

  3. Open the resource file which corresponds to the target culture, for example, Messages.es-ES.resx.

  4. Edit the resource file and save it.
  5. Change the solution configuration to Release.
  6. Build the project.
  7. Copy \src\Kendo.Mvc\bin\Release\Kendo.Mvc.dll and \src\Kendo.Mvc\bin\Release\es-ES\Kendo.Mvc.resources.dll to your ASP.NET MVC application.
  8. Update the Kendo.Mvc.dll assembly reference to the newly copied one.

Apart from building a custom version of Kendo.Mvc.dll, you can also specify a new value for the corresponding message in the MVC HtmlHelper configuration.

The following example demonstrates how to change the default message for the Create toolbar command of the Grid.

    @(Html.Kendo().Grid<Product>()
        .Toolbar(toolbar =>
        {
            toolbar.Create().Text("Add new product");
        })
    )

Creating New Localization Files

To add a localization file for a new language, you have to build a custom Kendo.Mvc.dll version because Kendo.Mvc.dll is a strongly named assembly and its private key is not shipped as part of the distribution.

To add new localization files in Telerik UI for ASP.NET MVC:

  1. Open the \src\Kendo.Mvc\Kendo.Mvc.csproj Visual Studio project. The \src directory is available only with the commercial version of Telerik UI for ASP.NET MVC.
  2. Locate the Resources directory in the solution explorer. It contains the resource files for the supported cultures.

    UI for ASP.NET MVC Resources

  3. Copy Messages.resx and paste it. Rename the copy to Messages.culture-code.resx, for example, Messages.es-MX.resx.

  4. Open the newly created resource file.
  5. Edit the resource file and save it. The Messagex.resx file contains the English messages.
  6. Change the solution configuration to Release.
  7. Build the project.
  8. Copy \src\Kendo.Mvc\bin\Release\Kendo.Mvc.dll and \src\Kendo.Mvc\bin\Release\es-MX\Kendo.Mvc.resources.dll to your ASP.NET MVC application.
  9. Update the Kendo.Mvc.dll assembly reference to the newly copied one.

Contribution

Currently, translations are not available for every language and some of the localization files may be incomplete. The full list of currently available translations is available in the Kendo UI Core repository.

If you notice any missing messages in the localization files or would like to add localization files for your language, do not hesitate to:

  1. Fork the repository.
  2. Apply the respective changes.
  3. Submit a pull request.

See Also

In this article