mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-14 19:04:51 +08:00
Fixed T usage in ValidationRules.
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using Orchard.DynamicForms.Services.Models;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Tokens;
|
||||
|
||||
namespace Orchard.DynamicForms.Services {
|
||||
|
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user