IStringLocalizer_localizer; public IActionResult Index() { string localizedString = _localizer["WelcomeMessage"].Value; return View(localizedString); }
IStringLocalizerIn this example, the GetString method is used to retrieve the value of the "ContactMessage" key from the shared resource file. The package library used here is Microsoft.AspNet.Mvc.Localization._localizer; public IActionResult Contact() { string localizedString = _localizer.GetString("ContactMessage"); return View(localizedString); }