'Best practice: custom localized data formatting in ASP.NET Core view

I'm working on a project that need to use localization.

I would like to localize for example a date like this:

  • en: "Tuesday 12 january 2022 at 10h30"
  • fr: "Mardi 12 janvier 2022 à 10h30"

But I have no idea how to do it properly. I was thinking about maybe using an helper class that I could inject in the view and inject the IViewLocalizer in this helper but I have no idea if that's possible (where should be the resource files then?)

Thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source