我研究过Asp.Net Core Web应用程序。
我试图像这样在我的通用控制器上使用本地化:
public class ManageController<TUser, TKey> : Controller
where TUser : IdentityUser<TKey>, new()
where TKey : IEquatable<TKey>
{
private readonly IStringLocalizer<ManageController<TUser, TKey>> _localizer;
public ManageController(IStringLocalizer<ManageController<TUser, TKey>> localizer)
{
_localizer = localizer;
}
}
很遗憾,此行不起作用-IStringLocalizer<ManageController<TUser, TKey>> localizer
-因为泛型类。
在此用例中如何使用IStringLocalizer
?