Fixed T usage in ValidationRules.

This commit is contained in:
Sipke Schoorstra
2015-10-15 21:46:50 +02:00
parent ff97d1e975
commit 054925c297
8 changed files with 7 additions and 8 deletions

View File

@@ -1,5 +1,4 @@
using Orchard.DynamicForms.Services.Models;
using Orchard.Localization;
using Orchard.Tokens;
namespace Orchard.DynamicForms.Services {

View File

@@ -22,7 +22,7 @@ namespace Orchard.DynamicForms.ValidationRules {
}
private LocalizedString GetValidationMessage(ValidationContext context) {
return T(Tokenize(ErrorMessage.WithDefault(String.Format("{0} must match the value of {1}.", context.FieldName, TargetName)), context));
return new LocalizedString(Tokenize(T(ErrorMessage.WithDefault(String.Format("{0} must match the value of {1}.", context.FieldName, TargetName))).ToString(), context));
}
}
}

View File

@@ -28,7 +28,7 @@ namespace Orchard.DynamicForms.ValidationRules {
}
private LocalizedString GetValidationMessage(ValidationContext context) {
return T(Tokenize(ErrorMessage.WithDefault(String.Format("{0} is not a valid email address.", context.FieldName)), context));
return new LocalizedString(Tokenize(T(ErrorMessage.WithDefault(String.Format("{0} is not a valid email address.", context.FieldName))).ToString(), context));
}
}
}

View File

@@ -18,7 +18,7 @@ namespace Orchard.DynamicForms.ValidationRules {
}
private LocalizedString GetValidationMessage(ValidationContext context) {
return T(Tokenize(ErrorMessage.WithDefault(String.Format("{0} is a mandatory field.", context.FieldName)), context));
return new LocalizedString(Tokenize(T(ErrorMessage.WithDefault(String.Format("{0} is a mandatory field.", context.FieldName))).ToString(), context));
}
}
}

View File

@@ -18,7 +18,7 @@ namespace Orchard.DynamicForms.ValidationRules {
}
private LocalizedString GetValidationMessage(ValidationContext context) {
return T(Tokenize(ErrorMessage.WithDefault(String.Format("An option is required for {0}.", context.FieldName)), context));
return new LocalizedString(Tokenize(T(ErrorMessage.WithDefault(String.Format("An option is required for {0}.", context.FieldName))).ToString(), context));
}
}
}

View File

@@ -27,7 +27,7 @@ namespace Orchard.DynamicForms.ValidationRules {
}
private LocalizedString GetValidationMessage(ValidationContext context) {
return T(Tokenize(ErrorMessage.WithDefault(String.Format("{0} must match the following pattern: {1}.", context.FieldName, Pattern)), context));
return new LocalizedString(Tokenize(T(ErrorMessage.WithDefault(String.Format("{0} must match the following pattern: {1}.", context.FieldName, Pattern))).ToString(), context));
}
}
}

View File

@@ -18,7 +18,7 @@ namespace Orchard.DynamicForms.ValidationRules {
}
private LocalizedString GetValidationMessage(ValidationContext context) {
return T(Tokenize(ErrorMessage.WithDefault(String.Format("{0} is a required field.", context.FieldName)), context));
return new LocalizedString(Tokenize(T(ErrorMessage.WithDefault(String.Format("{0} is a required field.", context.FieldName))).ToString(), context));
}
}
}

View File

@@ -41,7 +41,7 @@ namespace Orchard.DynamicForms.ValidationRules {
private LocalizedString GetValidationMessage(ValidationContext context) {
if (!String.IsNullOrWhiteSpace(ErrorMessage))
return T(Tokenize(String.Format(ErrorMessage, context.FieldName, Minimum, Maximum), context));
return new LocalizedString(Tokenize(String.Format(T(ErrorMessage).ToString(), context.FieldName, Minimum, Maximum), context));
if(Minimum != null && Maximum != null)
return T("{0} must be between {1} and {2} characters long.", context.FieldName, Minimum, Maximum);