#18156: Fixing localized attributes when using a metadata class

Work Item: 18156

--HG--
branch : 1.x
This commit is contained in:
ldhertert
2011-12-02 16:02:32 -08:00
parent 44a1f77efc
commit 1a0c0b75e4
@@ -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;