diff --git a/doc/book/intro.md b/doc/book/intro.md index 5ed7aeedd..190c4d31b 100644 --- a/doc/book/intro.md +++ b/doc/book/intro.md @@ -134,34 +134,14 @@ if (! $validator->isValid('word')) { ## Translating messages -> ### Translation compatibility -> -> In versions 2.0 - 2.1, `Zend\Validator\AbstractValidator` implemented -> `Zend\I18n\Translator\TranslatorAwareInterface` and accepted instances of -> `Zend\I18n\Translator\Translator`. Starting in version 2.2.0, zend-validator -> now defines a translator interface, > `Zend\Validator\Translator\TranslatorInterface`, -> as well as it's own -aware variant, > `Zend\Validator\Translator\TranslatorAwareInterface`. -> This was done to reduce dependencies for the component, and follows the -> principal of Separated Interfaces. -> -> The upshot is that if you are migrating from a pre-2.2 version, and receiving -> errors indicating that the translator provided does not implement -> `Zend\Validator\Translator\TranslatorInterface`, you will need to make a -> change to your code. +> ### Installation requirements > -> An implementation of `Zend\Validator\Translator\TranslatorInterface` is -> provided in `Zend\Mvc\I18n\Translator`, which also extends -> `Zend\I18n\Translator\Translator`. This version can be instantiated and used -> just as the original `Zend\I18n` version. -> -> A new service has also been registered with the MVC, `MvcTranslator`, which -> will return this specialized, bridge instance. +> The translation of validator messages depends on the zend-i18n component, so +> be sure to have it installed before getting started: > -> Most users should see no issues, as `Zend\Validator\ValidatorPluginManager` -> has been modified to use the `MvcTranslator` service internally, which is how -> most developers were getting the translator instance into validators in the -> first place. You will only need to change code if you were manually injecting -> the instance previously. +> ```bash +> $ composer require zendframework/zend-i18n +> ``` Validator classes provide a `setTranslator()` method with which you can specify an instance of `Zend\Validator\Translator\TranslatorInterface` which will @@ -211,3 +191,32 @@ if (! $validator->isTranslatorDisabled()) { It is also possible to use a translator instead of setting own messages with `setMessage()`. But doing so, you should keep in mind, that the translator works also on messages you set your own. + +> ### Translation compatibility +> +> In versions 2.0 - 2.1, `Zend\Validator\AbstractValidator` implemented +> `Zend\I18n\Translator\TranslatorAwareInterface` and accepted instances of +> `Zend\I18n\Translator\Translator`. Starting in version 2.2.0, zend-validator +> now defines a translator interface, > `Zend\Validator\Translator\TranslatorInterface`, +> as well as it's own -aware variant, > `Zend\Validator\Translator\TranslatorAwareInterface`. +> This was done to reduce dependencies for the component, and follows the +> principal of Separated Interfaces. +> +> The upshot is that if you are migrating from a pre-2.2 version, and receiving +> errors indicating that the translator provided does not implement +> `Zend\Validator\Translator\TranslatorInterface`, you will need to make a +> change to your code. +> +> An implementation of `Zend\Validator\Translator\TranslatorInterface` is +> provided in `Zend\Mvc\I18n\Translator`, which also extends +> `Zend\I18n\Translator\Translator`. This version can be instantiated and used +> just as the original `Zend\I18n` version. +> +> A new service has also been registered with the MVC, `MvcTranslator`, which +> will return this specialized, bridge instance. +> +> Most users should see no issues, as `Zend\Validator\ValidatorPluginManager` +> has been modified to use the `MvcTranslator` service internally, which is how +> most developers were getting the translator instance into validators in the +> first place. You will only need to change code if you were manually injecting +> the instance previously. diff --git a/doc/book/validator-chains.md b/doc/book/validator-chains.md index ee178ecc0..c9e45e9a8 100644 --- a/doc/book/validator-chains.md +++ b/doc/book/validator-chains.md @@ -1,5 +1,16 @@ # Validator Chains +## Basic Usage + +> ### Installation requirements +> +> The validator chain depends on the zend-servicemanager component, so be sure +> to have it installed before getting started: +> +> ```bash +> $ composer require zendframework/zend-servicemanager +> ``` + Often, multiple validations should be applied to some value in a particular order. The following code demonstrates a way to solve the example from the [introduction](intro.md), where a username must be between 6 and 12 alphanumeric diff --git a/doc/book/validators/db.md b/doc/book/validators/db.md index 23d7d21f0..481142361 100644 --- a/doc/book/validators/db.md +++ b/doc/book/validators/db.md @@ -11,7 +11,7 @@ given value. > getting started: > > ```bash -> $ composer require zendframework/zend-db` +> $ composer require zendframework/zend-db > ``` ## Supported options diff --git a/doc/book/validators/digits.md b/doc/book/validators/digits.md index 0792f78ea..102a344b4 100644 --- a/doc/book/validators/digits.md +++ b/doc/book/validators/digits.md @@ -8,7 +8,7 @@ > have it installed before getting started: > > ```bash -> $ composer require zendframework/zend-filter` +> $ composer require zendframework/zend-filter > ``` ## Supported options diff --git a/doc/book/validators/sitemap.md b/doc/book/validators/sitemap.md index d3380c7c7..fd5c28790 100644 --- a/doc/book/validators/sitemap.md +++ b/doc/book/validators/sitemap.md @@ -53,7 +53,7 @@ internally. > have it installed before getting started: > > ```bash -> $ composer require zendframework/zend-uri` +> $ composer require zendframework/zend-uri > ``` ## Priority