L() public static méthode

Gets localized string for given key name and current language.
public static L ( string name ) : string
name string Key name
Résultat string
Exemple #1
0
        public override IEnumerable <ModelValidator> GetValidators(ModelMetadata metadata, ControllerContext context)
        {
            var allValidators = base.GetValidators(metadata, context);
            var validators    = new List <ModelValidator>();

            foreach (var v in allValidators)
            {
                //如果不是系统默认的数字验证类,则用系统的
                if (v.GetType().Name != "NumericModelValidator")
                {
                    validators.Add(v);
                }
                else
                {
                    //用自定义替换系统的数字验证
                    var attribute = new NumericAttribute {
                        ErrorMessage = TranslationHelper.L("Custom.NumericModelValidator")
                    };
                    var validator = new DataAnnotationsModelValidator(metadata, context, attribute);
                    validators.Add(validator);
                }
            }
            return(validators);
        }
Exemple #2
0
 public override string FormatErrorMessage(string name)
 {
     return(string.Format(TranslationHelper.L(ErrorMessage), name));
 }
 public override string FormatErrorMessage(string name)
 {
     return(string.Format(TranslationHelper.L(ErrorMessage), name, MinimumLength, MaximumLength));
 }
Exemple #4
0
 public override string FormatErrorMessage(string name)
 {
     return(string.Format(TranslationHelper.L(ErrorMessage), OtherPropertyDisplayName, name));
 }
 public LocalizedDescription(string description)
 {
     _description     = TranslationHelper.L(description);
     DescriptionValue = _description;
 }