jsakamoto / Toolbelt.Blazor.I18nText

The class library that provides the ability to localize texts on your Blazor app!
Mozilla Public License 2.0
246 stars 25 forks source link

How would you translate form validation messages? #10

Open epsitec opened 5 years ago

epsitec commented 5 years ago

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.

agonzalezm commented 5 years ago

+1 add support for data annotations validations

jsakamoto commented 5 years ago

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

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 commented 4 years ago

Hi, all.

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

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.

I hope may this new package be helpful for you!

Seanxwy commented 1 year ago

Did you stop maintenance?

jsakamoto commented 1 year ago

@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.