Updating default validation messages on XbyK Forms.

September 9, 2024 10:24 AM

Our client is not happy with the default form verification messages e.g. "Enter a value" and would like to adjust these.

I'm not seeing anything in the roadmap specifically to do with resource strings or localization but is there anything like that planned for Xbyk - it was such a handy feature of >K13

I did see mention of multilingual forms on the roadmap so perhaps this sort of change will be accommodated by that update?


Environment

  • Xperience by Kentico version: [29.3.1]
  • .NET version: [8]

Answers

September 9, 2024 10:32 AM

This isn't specifically built for Forms, but there is a community package to add a Localization module which I believe works in a similar fashion to Kentico Xperience 13. I'm not sure if it is usable in Forms though, would need to test that.

You're right about the roadmap, multilingual forms are coming, I would expect this to handle all localisation of forms including the associated error messages, but that would be for Kentico to confirm.

Looking at the error message itself, it looks like Xperience by Kentico is uses general.requiresvalue internally as a resource string. I haven't tried this in Xperience by Kentico, but maybe you can register a resx file and add your own translation for it?

<data name="general.requiresvalue" xml:space="preserve">
  <value>Enter a value.</value>
</data>
September 9, 2024 5:00 PM

@dddruzynski

I did see mention of multilingual forms on the roadmap so perhaps this sort of change will be accommodated by that update?

Yes, like Liam mentioned, improvements to forms will come with the Multilingual forms roadmap feature.

The localization of that validation message is handled by ResHelper.GetString(...) which is backed by ILocalizationService.GetString(...)

You can decorate the existing ILocalizationService with your custom implementation for that specific general.requiresvalue resource key and forward the rest of the method calls to the existing implementation.

To answer this question, you have to login first.