Hello,
I'm trying to get resource strings out of the Localization application inside a .NET Core MVC app, which as I understand, should be done using the build-in IHtmlLocalizer. It seems like IHtmlLocalizer only works with .resx files, but doesn't query the database.
IHtmlLocalizer
.resx
If I use the code below, I get two different results. The first one just returns the key, because the key is not inside the .resx file, the 2nd one return the correct translation from the database.
@HtmlLocalizer[key] @ResHelper.GetString(key)
So ResHelper.GetString(key) still works as expected and I could use that in my views. However, I believe in order to translate data annotations on my view model properties, I rely on IHtmlLocalizer.
ResHelper.GetString(key)
How can I use IHtmlLocalizer or how can I translate data annotations using the database?
Thanks
I was able to use ResHelper by implementing a custom IStringLocalizer and IStringLocalizerFactory. Not sure if that's the proper solution. I assume Kentico would provide a build-in, better way to use the database as a localization source.
ResHelper
IStringLocalizer
IStringLocalizerFactory
Please, sign in to be able to submit a new answer.