Reputation: 81
I have a question. Localization is working in my application correctly but it feels a bit clunky.
I mean, is there a way to put all of these imports and injections in _Layout.cshtml
@using Microsoft.AspNetCore.Mvc.Localization;
@using Voxel.WebApis.IDP.Resources;
@inject IHtmlLocalizer<General> GeneralLocalizer;
And use my GeneralLocalizer in the rest of pages? Or i have to put all the "injection" and "using" code in every .cshtml i want to localize?
Right now parser error forces me to copy paste the code in every .cshtml i want to put translations...
Any solution?
Upvotes: 0
Views: 362
Reputation: 239380
This is pretty much exactly what _ViewImports.cshtml
is for.
Upvotes: 2