Toolbelt.Blazor.I18nText icon indicating copy to clipboard operation
Toolbelt.Blazor.I18nText copied to clipboard

How would you translate form validation messages?

Open epsitec opened this issue 5 years ago • 5 comments

I've come across your I18nText project while looking for a solution which would allow me to translate Blazor validation messages defined using ErrorMessage = "..." constants.

I don't see how I could use I18nText to provide the messages.

Do you have any ideas?

I've also opened an issue for the ASP.NET Core 3.0 documentation on this very same subject.

epsitec avatar Sep 20 '19 09:09 epsitec

+1 add support for data annotations validations

agonzalezm avatar Oct 03 '19 16:10 agonzalezm

For the first step to resolve this issue, I published "LocalizedDataAnnotationsValidator" component for Blazor.

  • https://www.nuget.org/packages/Toolbelt.Blazor.LocalizedDataAnnotationsValidator/

This component is built on "Microsoft.Extensions.Localization" infrastructure, therefore, a combination with this "Blazor I18n Text" doesn't work at this time.

For the next step, I'll integrate this "Blazor I18n Text" into "Microsoft.Extensions.Localization" infrastructure. In the plan, I'll make this "Blazor I18n Text" provide IStringLocalizer<T> service.

After completing these steps, static typing localization of data annotation validation error messages using "Blazor I18n Text" will come true.

jsakamoto avatar Nov 15 '19 12:11 jsakamoto

Hi, all.

Today, I published the "Blazor Internationalization(I18n) Text - StringLocalizer support" package.

  • https://www.nuget.org/packages/Toolbelt.Blazor.I18nText.StringLocalizerSupport/

I'm sorry that this is still a "beta" release, and there are no documents about how to use this package, yet. And also, It will be buggy, I think.

However, "Blazor Internationalization(I18n) Text - StringLocalizer support" maybe can works with "LocalizedDataAnnotationsValidator" component to localize validation messages.

Due to there are not enough documents at this time, please reference the sample site source code bellow.

  • https://github.com/jsakamoto/Toolbelt.Blazor.I18nText.StringLocalizerSupport/tree/master/SampleSites

I hope may this new package be helpful for you!

jsakamoto avatar Feb 14 '20 14:02 jsakamoto

Did you stop maintenance?

Seanxwy avatar Apr 24 '23 11:04 Seanxwy

@Seanxwy No, I don't intend to stop maintaining this project for now. But in fact, I admit that the priority of this project was going down lower than other my OSS projects.

jsakamoto avatar Apr 24 '23 22:04 jsakamoto