This is a migrated thread and some comments may be shown as answers.

Localize kendo grid

3 Answers 41 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jan-Frederik
Top achievements
Rank 1
Iron
Jan-Frederik asked on 09 Mar 2021, 08:48 AM

Hello, I would like to localize a kendo grid so that all messages and formats are using a specific language (german in my case).

By default, the grid uses english language.

I tried to include the language script and kendo.culture in the view.

<script src="@Url.Content("~/lib/kendo-ui/js/cultures/kendo.culture.de-DE.min.js")"></script>

kendo.culture('de-DE');

This causes two problems. The culture is now changed globally, whereas I would only like to localize a specific control.

Secondly, if I edit a cell in the grid, it does not display the german format, but uses english format.

3 Answers, 1 is accepted

Sort by
0
Neli
Telerik team
answered on 12 Mar 2021, 08:46 AM

Hi Jan-Frederik,

I would suggest you to set a different culture and messages on the page. For example, you could set the German culture and messages on the page where the Grid is and load another language on the rest of the pages. 

Note, that all dates, currencies, numbers are depending on the culture. While the localization settings are taking effect when it is up to messages.  For example, if a DateTimePicker is added in the Grid, the date format depends on the culture settings. At the same time, the messages in the Grid will depend on the localization settings. Thus, you will need to change both - globalization and localization. I would suggest you take a look at the following articles regarding Globalization and Localization.

- https://docs.telerik.com/aspnet-mvc/globalization/localization

- https://docs.telerik.com/aspnet-mvc/globalization/overview

And the Globalization Demo is linked below:

- https://demos.telerik.com/aspnet-mvc/grid/globalization

For changing messages in a specific Grid you could also use different messages options that the Grid provides. For example, the text in the command buttons could be changed by using the messages.commands option. 

You could also take a look at the Forum thread link here and check if the provided suggestion by using the setOptions for changing the culture is suitable for your scenario.

- https://www.telerik.com/forums/change-language-without-destroy

Regards,
Neli
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

0
Jan-Frederik
Top achievements
Rank 1
Iron
answered on 12 Mar 2021, 05:35 PM

Hello Neli,

thank you for your answer, it is already very helpful. One question: is it default behaviour, that on editing a cell, the content loses it's format? I perceived that after culture change, an unedited cell shows f.ex. 2.431,99 (german number format), but on edit it shows 2431.99 (english). Will an edited cell always display english format or is this a mistake by me?

0
Neli
Telerik team
answered on 17 Mar 2021, 04:17 PM

Hello Jan-Frederik,

I would suggest reviewing the following threads from our Forum where such an issue is discussed. In the threads, you will find suggestions for resolving the issue. Please try the suggested solutions and let me know in case the issue continues to persist. 

- https://www.telerik.com/forums/culture-problems-when-editing-numeric-values-inside-grid-cell

- https://www.telerik.com/forums/setting-culture-not-working-in-edit-functionality-of-grid

You could also check if the cultures on the client and on the server are matching as described in the Matching Cultures section linked below:

- https://docs.telerik.com/aspnet-mvc/globalization/overview#matching-cultures

Regards,
Neli
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Grid
Asked by
Jan-Frederik
Top achievements
Rank 1
Iron
Answers by
Neli
Telerik team
Jan-Frederik
Top achievements
Rank 1
Iron
Share this question
or