Localisation

This commit is contained in:
2018-03-26 23:18:48 +02:00
parent e1dd427359
commit eb5e218223
23 changed files with 26 additions and 39 deletions

View File

@ -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];
}
}
}

View File

@ -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) {

View File

@ -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,

View File

@ -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];
}
}
}