-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Support localizing [DisplayAttribute] via IStringLocalizer #3518
Comments
I agree this is something we should investigate. I imagine we'd do the work in |
Can we extend public class LocalizedDataAnnotationsModelMetadataProvider: DataAnnotationsModelMetadataProvider
{
protected override ModelMetadata CreateMetadata(IEnumerable<Attribute> attributes, Type containerType, Func<object> modelAccessor, Type modelType, string propertyName)
{
var meta = base.CreateMetadata(attributes, containerType, modelAccessor, modelType, propertyName);
meta.DisplayName = Localizer[propertyName];
}
} |
At this stage this is extremely unlikely to make it into 1.0.0, but we'll revisit it after we release. |
I'm agree with you, this may be move to the backlog, because it need more investigation .. |
there is no workaround or a temporary solution we can use until you support it? |
Is there any progress on this issue? What's the schedule for this issue? In the current state DisplayAttribute is rather useless for localized applications. |
@ManuelHaas As I see it's still in backlog |
@Eilon let's do this one in 1.1 if it fits. |
It's Ok if you want to do it in 1.1, but is there ANY current workaround for this one? Most of my code was written when back in RC1 when localization wasn't even moving, but I just assumed it will work when it released, and now here I am, getting a bunch of not localized keys as results. I'm like the 5th person asking for help in this one. |
@ShikiGami we'll see if there's a workaround that works on 1.0, but I can't immediately think of any simple workaround. |
Putting in the 1.1 milestone. @ryanbrandenburg , I marked this as needs-design because I'm not sure if this is straightforward ("just another attribute") or if this requires some extra plumbing in the system. So, have a look at this, and if it's not trivial, let's see if we can come up with some ideas and run it by @DamianEdwards / @dougbu (because it probably affects Model Metadata or something). |
Keep waiting on this issiue. |
Today we only localize validation based data annotations. We should expand this outside of the realm of validation (especially since you do a
services.AddDataAnnotationsLocalization
which says nothing about only adding validation based data annotations.Having support like this would enable scenarios such as:
Model:
Page
This issue is for more than just
[Display]
but this data annotation is the one that showed itself during my sign off activities.The text was updated successfully, but these errors were encountered: