Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update guides in english and Translate guides into Brazilian Portuguese #691

Merged
merged 2 commits into from
Apr 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/guide/en/built-in-rules-composite.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ And use it just like a single regular rule:
use Yiisoft\Validator\Validator;

$result = (new Validator())->validate('John', new UsernameRuleSet());
````
```

It can also be combined with [Nested] rule to reuse rules for multiple attributes:

Expand Down
2 changes: 1 addition & 1 deletion docs/guide/en/built-in-rules-stop-on-error.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ $rules = [
]),
// Skipping of other intermediate rules depends on `skipOnError` option set in these intermediate rules.
'attribute4' => new SimpleRule4(), // Not skipped, because `skipOnError` is `false` by default.
]);
];
```

Use grouping / ordering / `skipOnError` option to achieve the desired effect.
4 changes: 2 additions & 2 deletions docs/guide/en/built-in-rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ Here is a list of all available built-in rules, divided by category.

### Boolean rules

- [Boolean](../../../src/Rule/Boolean.php)
- [IsTrue](../../../src/Rule/IsTrue.php)
- [Boolean](../../../src/Rule/BooleanValue.php)
- [IsTrue](../../../src/Rule/TrueValue.php)

### Number rules

Expand Down
2 changes: 1 addition & 1 deletion docs/guide/en/conditional-validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ is considered non-empty and validated without skipping (default).
(corresponding attribute must be present) and non-empty values (not `null`, `[]`, or `''`) are validated.
- If a custom callback is set, it is used to determine emptiness.

`false` is usually more suitable for HTML forms and `true` - for APIs.
`false` is usually more suitable for HTML forms and `true` for APIs.

There are some more conditions that have no shortcuts and need to be set explicitly because they are less used:

Expand Down
3 changes: 1 addition & 2 deletions docs/guide/en/configuring-rules-via-php-attributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ Given a single `User` entity / model:
```php
use Yiisoft\Validator\Rule\Integer;
use Yiisoft\Validator\Rule\Length;
use Yiisoft\Validator\Rule\Number;
use Yiisoft\Validator\Rule\Required;

[
Expand Down Expand Up @@ -83,7 +82,6 @@ use Yiisoft\Validator\Rule\Each;
use Yiisoft\Validator\Rule\Integer;
use Yiisoft\Validator\Rule\Length;
use Yiisoft\Validator\Rule\Nested;
use Yiisoft\Validator\Rule\Number;
use Yiisoft\Validator\Rule\Required;
use Yiisoft\Validator\Rule\Url;

Expand Down Expand Up @@ -226,6 +224,7 @@ In this case the set of rules for `Truck` will be:

```php
use Yiisoft\Validator\Rule\BooleanValue;
use Yiisoft\Validator\Rule\Number;
use Yiisoft\Validator\Rule\Required;

[
Expand Down
3 changes: 1 addition & 2 deletions docs/guide/en/creating-custom-rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ final class YamlHandler implements RuleHandlerInterface
> **Note:** Using [yaml_parse] additionally requires `yaml` PHP extension.

> **Note:** Processing untrusted user input with `yaml_parse()` can be dangerous with certain settings. Please refer to
> [yaml_parse docs] for more details.
> [yaml_parse] docs for more details.

### Wrapping validation

Expand Down Expand Up @@ -447,7 +447,6 @@ someone else - make it available as an extension.
[array_is_list]: https://www.php.net/manual/en/function.array-is-list.php
[YAML]: https://en.wikipedia.org/wiki/YAML
[yaml_parse]: https://www.php.net/manual/en/function.yaml-parse.php
[yaml_parse docs]: https://www.php.net/manual/en/function.yaml-parse.php
[scenarios from Yii 2]: https://www.yiiframework.com/doc/guide/2.0/en/structure-models#scenarios
[Yii Validator Scenarios]: https://github.com/vjik/yii-validator-scenarios
[Sergei Predvoditelev]: https://github.com/vjik
Expand Down
4 changes: 2 additions & 2 deletions docs/guide/en/extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ approach is discouraged and the recommended way with this package is using separ
Sure, this will lead to some code duplication, but it's acceptable and will pay off in the future.
Anyway, we decided to make it available through an extension, but use it with caution.

[Yii Validator Scenarios] (`vjik/yii-validator-scenarios`) package from a core team member [Sergei Predvoditelev] adds
[Yii Validator Scenarios] package from a core team member [Sergei Predvoditelev] adds
special `On` rule which allows to wrap other rules by declaring specific scenarios.

An example of the class using scenarios:
Expand Down Expand Up @@ -59,7 +59,7 @@ $result = (new Validator())->validate($userDto, context: $context));

## Wrapper for Symfony rules

[Yii Validator Symfony Rule] (`vjik/yii-validator-symfony-rule`) package from a core team member [Sergei Predvoditelev]
[Yii Validator Symfony Rule] package from a core team member [Sergei Predvoditelev]
adapts [constraints from Symfony framework] to be used as rules in Yii Validator.

Using it is straightforward, all you have to do is wrap a Symfony constraint (or a list of them) with `SymfonyRule` rule
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/en/result.md
Original file line number Diff line number Diff line change
Expand Up @@ -286,4 +286,4 @@ $result->getAttributeErrors('email');
```

[Using keys containing separator / shortcut]: built-in-rules-nested.md#using-keys-containing-separator--shortcut
[will cast keys to the int type]: https://www.php.net/manual/en/language.oop5.properties.php#language.oop5.properties.readonly-properties
[will cast keys to the int type]: https://www.php.net/manual/en/language.types.array.php
30 changes: 30 additions & 0 deletions docs/guide/pt-BR/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Validador Yii

Pacote para validação de dados.

## Guias

### Validação

- [Usando o validador](using-validator.md)
- [Resultado](result.md)
- [Validação condicional](conditional-validation.md)
- [Personalizando mensagens de erro](customizing-error-messages.md)

### Regras

- [Regras integradas](built-in-rules.md)
- [Callback](built-in-rules-callback.md)
- [Composite](built-in-rules-composite.md)
- [Each](built-in-rules-each.md)
- [Nested](built-in-rules-nested.md)
- [Required](built-in-rules-required.md)
- [StopOnError](built-in-rules-stop-on-error.md)
- [Configurando regras via atributos PHP](configuring-rules-via-php-attributes.md)
- [Criando regras personalizadas](creating-custom-rules.md)


### Diversos

- [Validação do lado do cliente](client-side-validation.md)
- [Extensões](extensions.md)
Loading
Loading