Localisation
This commit is contained in:
parent
41d803f851
commit
757c5ca2ea
23 changed files with 26 additions and 39 deletions
|
|
@ -1,5 +1,4 @@
|
|||
using System.Resources;
|
||||
using Yavsc.Resources;
|
||||
|
||||
namespace Yavsc.Attributes.Validation
|
||||
{
|
||||
|
|
@ -11,7 +10,7 @@ namespace Yavsc.Attributes.Validation
|
|||
|
||||
public override string FormatErrorMessage(string name)
|
||||
{
|
||||
return ResourcesHelpers.DefaultResourceManager.GetString(this.ErrorMessageResourceName);
|
||||
return ResourcesHelpers.GlobalLocalizer[this.ErrorMessageResourceName];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -16,7 +16,7 @@ namespace Yavsc.Attributes.Validation
|
|||
}
|
||||
public YaRequiredAttribute ()
|
||||
{
|
||||
this.ErrorMessage = ResourcesHelpers.DefaultResourceManager.GetString("RequiredField");
|
||||
this.ErrorMessage = ResourcesHelpers.GlobalLocalizer["RequiredField"];
|
||||
|
||||
}
|
||||
public override bool IsValid(object value) {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ namespace Yavsc.Attributes.Validation
|
|||
private long maxLen;
|
||||
public YaStringLength(long maxLen) : base(
|
||||
()=>string.Format(
|
||||
ResourcesHelpers.DefaultResourceManager.GetString("BadStringLength"),
|
||||
ResourcesHelpers.GlobalLocalizer["BadStringLength"],
|
||||
maxLen))
|
||||
{
|
||||
this.maxLen = maxLen;
|
||||
|
|
@ -43,12 +43,12 @@ namespace Yavsc.Attributes.Validation
|
|||
if (MinLen<0) {
|
||||
// DetailledMaxStringLength
|
||||
return string.Format(
|
||||
ResourcesHelpers.DefaultResourceManager.GetString("DetailledMaxStringLength"),
|
||||
ResourcesHelpers.GlobalLocalizer["DetailledMaxStringLength"],
|
||||
maxLen,
|
||||
excedent);
|
||||
} else
|
||||
return string.Format(
|
||||
ResourcesHelpers.DefaultResourceManager.GetString("DetailledMinMaxStringLength"),
|
||||
ResourcesHelpers.GlobalLocalizer["DetailledMinMaxStringLength"],
|
||||
MinLen,
|
||||
maxLen,
|
||||
manquant,
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ namespace Yavsc.Attributes.Validation
|
|||
{
|
||||
public class YaValidationAttribute : System.ComponentModel.DataAnnotations.ValidationAttribute
|
||||
{
|
||||
public YaValidationAttribute() : base(()=> ResourcesHelpers.DefaultResourceManager.GetString("validationError"))
|
||||
public YaValidationAttribute() : base(()=> ResourcesHelpers.GlobalLocalizer["validationError"])
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -16,7 +16,7 @@ namespace Yavsc.Attributes.Validation
|
|||
|
||||
public override string FormatErrorMessage(string name)
|
||||
{
|
||||
return ResourcesHelpers.DefaultResourceManager.GetString(name);
|
||||
return ResourcesHelpers.GlobalLocalizer[name];
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue