I have a custom convention that requires localized strings inside of it. AFAIK the only way to instantiate an IStringLocalizer is DependencyInjection.
How can I use an IStringLocalizer inside of my CustomConvention?
The convention isregistered like this
public void ConfigureServices(IServiceCollection services)
{
//First I register the localization settings
services.AddLocalization(o =>
{
o.ResourcesPath = "Resources";
});
services.AddMvc(options =>
{
//My custom convention, I would need to inject an IStringLocalizer
//into constructor here, but I can' instantiate it
options.Conventions.Add(new LocalizationRouteConvention());
})
}