This is a migrated thread and some comments may be shown as answers.
Globalization/Localization on validated fields doesn't seem to work
3 Answers 16 Views
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 15 Aug 2019, 05:25 PM

Hello,

I am experiencing a problem applying culture to the validation messages in my editable grid. I experience the exact same problem as in the following demo:  https://demos.telerik.com/aspnet-core/grid/globalization?culture=fr-FR

 

As a user I would expect the validation message to be localized but they don't seem to be.

To reproduce,

  1. Set the culture to anything other then english,
  2. Edit a row,
  3. Empty the "Name" column,
  4. click out of the textbox to activate validation and notice that the validation message displayed is in english.

 

Any help on this will be greatly appreciated!

Thank you

3 Answers, 1 is accepted

Sort by
0
Tsvetomir
Telerik team
answered on 20 Aug 2019, 07:15 AM
Hi David,

Thank you for the provided information and steps on how to replicate the behavior of interest.

The behavior that you have shared is actually a simple validation message which comes from the ASP.NET MVC Framework. And more specifically, it comes from the model. Those validation messages could be customized as follows:

[Required(ErrorMessage = "Age is required!!")]
public int Age { get; set; }

The localization of the Kendo UI widgets aims to localize all of the buttons, tooltips, strings within the context of the widget. Since the validation is applied externally, it has to be handled separately.

I hope this helps.


Best regards,
Tsvetomir
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
David
Top achievements
Rank 1
answered on 09 Sep 2019, 08:20 PM

Hello Tsvetomir,

I understand what you are saying but this is not the approach I took to fix this problem. It could of worked but our system is Database first so the model often gets refreshed & overriden by the scaffolding tools. Instead, I modified the default message templates to new localized ones. 

To achieve this I followed the steps found here : https://blogs.msdn.microsoft.com/mvpawardprogram/2017/05/09/aspnetcore-mvc-error-message/ and customized the implementation a little bit to suit my needs.

 

I believe your response helped me find this alternative so I am thankful :)

Have a nice day!

David

0
Tsvetomir
Telerik team
answered on 10 Sep 2019, 04:55 AM
Hi David,

I am glad to hear that you have managed to resolve the issue. And thank you for sharing your solution with the community.

Apart from the model's error message customization, they could be modified on the client-side. An example of a custom validation and a custom message could be found here:

https://demos.telerik.com/aspnet-core/grid/editing-custom-validation

However, this would change the message only on the client-side, and only for the client-side validation. If you would like it to come from the server-side, the approach suggested in the article has to be followed. 


Kind regards,
Tsvetomir
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Asked by
David
Top achievements
Rank 1
Answers by
Tsvetomir
Telerik team
David
Top achievements
Rank 1
Share this question
or