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

Telerik UI for ASP.NET Core 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 Core helpers by including an additional script file in the document.

Localization Files

Officially, the Telerik UI for ASP.NET Core 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 Core 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 Core download page and download the telerik.ui.for.aspnet.core.2024.4.1112.commercial-source.zip file.

  3. Extract the archive and navigate to the \src\AspNet.Core\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 Core release that follows that contribution. Refer to the section on contributing.

Setting the Current Language

By default, all Telerik UI for ASP.NET Core helpers display their messages in US English. To replace the default text messages, include a language specific kendo.messages.<language>.js file in the document.

Include the localization script before the helpers are initialized. The best place to include it is right after the Kendo UI JavaScript files.

The following example demonstrates how to register the localization script in the _Layout.cshtml file.

<script src="~/lib/jquery/dist/jquery.js"></script>
<script src="~/lib/kendo-ui/js/kendo.all.min.js"></script>
<script src="~/lib/kendo-ui/js/kendo.aspnetmvc.min.js"></script>
<script src="~/lib/kendo-ui/js/cultures/kendo.messages.es-ES.min.js"></script>

The following example demonstrates how to register the localization script in the_Layout.cshtml file by using CDN.

<script src="https://code.jquery.com/jquery-3.7.0.min.js"></script>
<script src="https://kendo.cdn.telerik.com/<version>/js/kendo.all.min.js"></script>
<script src="https://kendo.cdn.telerik.com/<version>/js/kendo.aspnetmvc.min.js"></script>
<script src="https://kendo.cdn.telerik.com/<version>/js/messages/kendo.messages.es-ES.min.js"></script>

To change the current culture and language dynamically, refer to the demo on globalization by the Grid.

Currently, translations are not available for every language and some of the localization files may be incomplete. For more information on the full list of available translations, refer to the section on contributing.

Creating New Localization Files

The localization script replaces the default messages in the helper prototype with their equivalent translations. The file has to be named by following the kendo.messages.<language>.js convention. A language code identifier list is available for free download from the Microsoft developer network website.

The following example demonstrates how to create a new localization file. The kendo.messages.en-US.js contains all messages and may be used as a reference when you create the new localization file—copy the file, rename it, and translate the messages.

/* <Helper-name> messages */

if (kendo.ui.<Helper-name>) {
kendo.ui.<Helper-name>.prototype.options.messages =
$.extend(true, kendo.ui.<Helper-name>.prototype.options.messages,{
  "<message-name>": "<translation",
  //...
});
}

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