Skip to content

Instantly share code, notes, and snippets.

View emrearig's full-sized avatar

EMRE ARIĞ emrearig

View GitHub Profile
@emrearig
emrearig / HomeController.cs
Created July 30, 2024 12:55 — forked from eduardomps/HomeController.cs
ASP.NET Core MVC Localization/ViewLocalization using a shared .resx file
// src/Project/Controllers/HomeController.cs
// using the HomeController as an example
// you don't need it if you only want to localize strings in your views
public IStringLocalizer<SharedResource> _localizer;
// here comes the magic: the DI will inject your localizer
// created by the factory you set up at Startup.ConfigureServices()
public HomeController(IStringLocalizer<SharedResource> localizer)
{