HBS.LocalizedValidationAttributes.Kentico.MVC 12.29.1

Localized variations of the default DataAnnotation Attributes that allow your ErrorMessage to contain and resolve Localized macro expressions

Install-Package HBS.LocalizedValidationAttributes.Kentico.MVC -Version 12.29.1
dotnet add package HBS.LocalizedValidationAttributes.Kentico.MVC --version 12.29.1
<PackageReference Include="HBS.LocalizedValidationAttributes.Kentico.MVC" Version="12.29.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add HBS.LocalizedValidationAttributes.Kentico.MVC --version 12.29.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: HBS.LocalizedValidationAttributes.Kentico.MVC, 12.29.1"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install HBS.LocalizedValidationAttributes.Kentico.MVC as a Cake Addin
#addin nuget:?package=HBS.LocalizedValidationAttributes.Kentico.MVC&version=12.29.1

// Install HBS.LocalizedValidationAttributes.Kentico.MVC as a Cake Tool
#tool nuget:?package=HBS.LocalizedValidationAttributes.Kentico.MVC&version=12.29.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Kentico Localized Validation Attributes

This set of Validation Attributes extend the default DataAnnotations Attributes, allowing you to have Error Messages that contain Kentico Localized String Macros (ex "{$ customvalidation.message $}")

There are also a handful of Validation Attributes that are not in the assembly due to dependencies on Interfaces that you may wish to implement yourslef, these are in the Other Helpful Validation Attributes

Installation

  1. Install the HBS.LocalizedValidationAttributes.Kentico.MVC NuGet Package to your MVC Site

Usage

Where you would put your normal ValidationAttribute, just add "Localized" before it.

Example:
[Required(ErrorMessage = "I wish i was localized")] [LocalizedRequired(ErrorMessage = "{$ custom.requirederror $}"]

You can also inherit LocalizedValidationAttribute instead of ValidationAttribute for your own custom validations. This will, by default, localize the error message, but you may need to still overwrite the FormatErrorMessage if you need to add additional properties to the formatted message.

Example of an inherited ValidationAttribute can be found here.

Example of an inherited ValidationAttribute with an overwritten FormatErrorMessage can be found here.

Kentico Localized Validation Attributes

This set of Validation Attributes extend the default DataAnnotations Attributes, allowing you to have Error Messages that contain Kentico Localized String Macros (ex "{$ customvalidation.message $}")

There are also a handful of Validation Attributes that are not in the assembly due to dependencies on Interfaces that you may wish to implement yourslef, these are in the Other Helpful Validation Attributes

Installation

  1. Install the HBS.LocalizedValidationAttributes.Kentico.MVC NuGet Package to your MVC Site

Usage

Where you would put your normal ValidationAttribute, just add "Localized" before it.

Example:
[Required(ErrorMessage = "I wish i was localized")] [LocalizedRequired(ErrorMessage = "{$ custom.requirederror $}"]

You can also inherit LocalizedValidationAttribute instead of ValidationAttribute for your own custom validations. This will, by default, localize the error message, but you may need to still overwrite the FormatErrorMessage if you need to add additional properties to the formatted message.

Example of an inherited ValidationAttribute can be found here.

Example of an inherited ValidationAttribute with an overwritten FormatErrorMessage can be found here.

Release Notes

Adding missing UrlAttribute and added IClientValidation logic, thought it would inherit from base class.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
12.29.1 529 5/14/2020
12.29.0 140 5/14/2020