C# ASP.NET Core 3.1中的本地化

C# ASP.NET Core 3.1中的本地化,c#,.net,localization,.net-core-3.1,C#,.net,Localization,.net Core 3.1,我正在尝试在.NET Core 3.1应用程序中使用本地化。 我已将以下内容添加到我的Startup.cs文件中: services.AddLocalization(o => o.ResourcesPath = "Resources"); services.Configure<RequestLocalizationOptions>(options => { var supportedCultures = new[] { new Cultur

我正在尝试在.NET Core 3.1应用程序中使用本地化。
我已将以下内容添加到我的
Startup.cs
文件中:

services.AddLocalization(o => o.ResourcesPath = "Resources");
services.Configure<RequestLocalizationOptions>(options =>
{
    var supportedCultures = new[]
    {
        new CultureInfo("de-DE"),
        new CultureInfo("en-US")
    };
    options.DefaultRequestCulture = new RequestCulture("de-DE", "de-DE");
    options.SupportedCultures = supportedCultures;
    options.SupportedUICultures = supportedCultures;
});
在我需要本地化的类中,我已经将
IStringLocalizer stringLocalizer
注入到构造函数中,并尝试使用
var titel=this.stringLocalizer[“ConfirmationMailTitel”]

不幸的是,当查看结果时,它会显示“Resource not found=true”

我错过什么了吗


提前感谢

如果资源文件夹不在asp.net项目中,则必须执行以下操作:

        private readonly IStringLocalizer _stringLocalizer;
     
        public TestController(IStringLocalizerFactory stringLocalizerFactory)
        {
           _stringLocalizer = stringLocalizerFactory.Create(
            typeof(ConfirmationMailTitel).FullName,
            "ResourcesAssemblyName");
         }

如果资源文件夹不在asp.net项目中,则必须执行以下操作:

        private readonly IStringLocalizer _stringLocalizer;
     
        public TestController(IStringLocalizerFactory stringLocalizerFactory)
        {
           _stringLocalizer = stringLocalizerFactory.Create(
            typeof(ConfirmationMailTitel).FullName,
            "ResourcesAssemblyName");
         }