Description
EPPlus currently supports DisplayAttribute, but it does not appear to handle the ResourceType property correctly.
According to the official Microsoft documentation for DisplayAttribute.ResourceType:
"If this value is null, the ShortName, Name, Prompt, and Description properties are assumed to be literal, non-localized strings. If this value is not null, the string properties are assumed to be the names of public static properties that return the actual string value."
Reference:
https://learn.microsoft.com/en-us/dotnet/api/system.componentmodel.dataannotations.displayattribute.resourcetype?view=netframework-4.8#system-componentmodel-dataannotations-displayattribute-resourcetype
Example
When the attribute is used like this:
[Display(Name = nameof(PropertyNames.First), ResourceType = typeof(PropertyNames))]
public string FirstName { get; set; }
the Excel column header should not be First.
Instead, EPPlus should resolve the resource property and use the actual localized text stored in the PropertyNames resource.
Expected behavior
EPPlus should use the value returned by the resource property referenced through ResourceType, rather than the resource property name itself.
Actual behavior
EPPlus uses the literal property name (First) as the column header instead of the localized string value from the resource.
Description
EPPlus currently supports
DisplayAttribute, but it does not appear to handle theResourceTypeproperty correctly.According to the official Microsoft documentation for
DisplayAttribute.ResourceType:Reference:
https://learn.microsoft.com/en-us/dotnet/api/system.componentmodel.dataannotations.displayattribute.resourcetype?view=netframework-4.8#system-componentmodel-dataannotations-displayattribute-resourcetype
Example
When the attribute is used like this:
the Excel column header should not be
First.Instead, EPPlus should resolve the resource property and use the actual localized text stored in the PropertyNames resource.
Expected behavior
EPPlus should use the value returned by the resource property referenced through
ResourceType, rather than the resource property name itself.Actual behavior
EPPlus uses the literal property name (
First) as the column header instead of the localized string value from the resource.