How can i localize Name
in Display
attribute?
For example:
[Display(Name = "Library name")]
public string LibraryName { get; set; }
What should I do with that attribute?
ASP.NET Core 1.0 does not support out-of-the-box localization based on the new introduced localization approach for the Display
attribute. One way to go is to use the prior to ASP.NET Core 1.0 approach for localization with resource files. I have implemented a simple demo project which shows how to localize the display attribute here https://github.com/feradz/ASPNetCoreLocalization/wiki DataAnnotations.resx
is used for localizing the Display
attribute.
In this approach the display name cannot contain special characters and spaces. For example the display name cannot be Library name
but it can be LibraryName
[Display(Name="LibraryName", ResourceType = typeof(Resources.DataAnnotations))]
public string LibraryName { get; set; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With