You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 23, 2023. It is now read-only.
Hello, Do you have any example on localizing DisplayAttribute or similar? i tried creating my own localized attribute but it seems you can't proper DI into attribute classes, here is what i tried:
public sealed class LocalizedDisplayAttribute : Attribute
{
protected IJsonStringLocalizer StringLocalizer;
public LocalizedDisplayAttribute(string displayName)
{
StringLocalizer = HttpContextHelper.HttpContext.RequestServices.GetService<IJsonStringLocalizer>();
DisplayName = displayName;
}
public string DisplayName
{
get
{
return StringLocalizer[DisplayName];
}
set
{
}
}
}
unfortunately it always returns null service to me, tried using httpcontextaccessor, direct injection and what not..
if anyone have done this already please help.
Hello, Do you have any example on localizing DisplayAttribute or similar? i tried creating my own localized attribute but it seems you can't proper DI into attribute classes, here is what i tried:
unfortunately it always returns null service to me, tried using httpcontextaccessor, direct injection and what not..
if anyone have done this already please help.