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:
Log in to your Telerik account.
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.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:
- 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. -
Locate the
Resources
directory in the solution explorer. It contains the resource files for the supported cultures. Open the resource file which corresponds to the target culture, for example,
Messages.es-ES.resx
.- Edit the resource file and save it.
- Change the solution configuration to
Release
. - Build the project.
- 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. - 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:
- 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. -
Locate the
Resources
directory in the solution explorer. It contains the resource files for the supported cultures. Copy
Messages.resx
and paste it. Rename the copy toMessages.culture-code.resx
, for example,Messages.es-MX.resx
.- Open the newly created resource file.
- Edit the resource file and save it. The
Messagex.resx
file contains the English messages. - Change the solution configuration to
Release
. - Build the project.
- 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. - 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:
- Fork the repository.
- Apply the respective changes.
- Submit a pull request.