Experience 13 database based localization with .NET Core app

Andy Bochmann asked on January 27, 2021 23:29

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.

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.

How can I use IHtmlLocalizer or how can I translate data annotations using the database?

Thanks

Recent Answers


Andy Bochmann answered on January 28, 2021 01:35

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.

0 votesVote for this answer Mark as a Correct answer

alex sunny answered on January 29, 2021 09:42 (last edited on February 11, 2021 12:42)

Hi Martin, just want to let you know that today Ive been trying to install the Kentico Admin Mobile App on my Google Pixel 2 XL which is running on Android 8.1. But whenever I will open the app it is only loading a blank screen https://ometv.onl https://chatroulette.top https://omegle.wtf https://bazoocam.cam on the startup and crashing itself gradually. Will appreciate if you can help me get it working normally.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.