Skip to content

Instantly share code, notes, and snippets.

View eduardomps's full-sized avatar

Eduardo Miranda eduardomps

  • Knewin
  • Florianópolis
View GitHub Profile
@eduardomps
eduardomps / HomeController.cs
Created July 31, 2016 21:41
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)
{