Having a library contains resx files and using this document Globalization and localization in ASP.NET Core and adding following codes in Startup.cs we localized our web application:
services.AddMvc()
.AddDataAnnotationsLocalization(option =>
{
option.DataAnnotationLocalizerProvider = (type, factory) => factory.Create(typeof({the-resx-library}));
})
.AddViewLocalization()
In controllers:
private readonly IStringLocalizer<{the-resx-library}> _localizer;
public AccountController(IStringLocalizer<{the-resx-library}> localizer)
{
_localizer = localizer;
}
[HttpGet]
public IActionResult Index()
{
string text = this._localizer["Hello"];
return View();
}
The question is how can we use that resx library in a console application? That console application generates content based on user's chosen language and email it.