mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
#18156: Fixing localized attributes when using a metadata class
Work Item: 18156 --HG-- branch : 1.x
This commit is contained in:
@@ -22,13 +22,14 @@ namespace Orchard.Mvc.DataAnnotations {
|
||||
var localizedAttributes = new List<Attribute>();
|
||||
|
||||
// overriden messages have their localization in the scope of the class they are applied to
|
||||
var tContainer = new Lazy<Localizer>(() => LocalizationUtilities.Resolve(context, metadata.ContainerType.FullName));
|
||||
var tContainer = new Lazy<Localizer>(() => LocalizationUtilities.Resolve(context, (metadata.ContainerType ?? metadata.ModelType).FullName));
|
||||
|
||||
foreach (var attribute in attributes) {
|
||||
Func<ValidationAttribute, Localizer, ValidationAttribute> localizedAttribute;
|
||||
|
||||
// default translations use the attribute's scope, e.g., Orchard.Mvc.DataAnnotations.LocalizedRequiredAttribute
|
||||
var tProvider = new Lazy<Localizer>(() => LocalizationUtilities.Resolve(context, attribute.GetType().FullName));
|
||||
var localAttribute = attribute;
|
||||
var tProvider = new Lazy<Localizer>(() => LocalizationUtilities.Resolve(context, localAttribute.GetType().FullName));
|
||||
|
||||
var validationAttribute = attribute as ValidationAttribute;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user