valida 1.1.2

Modular validation system for Rust with support for nested structures and localization.
Documentation
# ๐ŸŒ Localization Setup

Valida natively integrates with [`rust-i18n`](https://github.com/longbridge/rust-i18n), enabling rich multi-language support without requiring external libraries like Fluent. You can use built-in language packs or define your own translations for custom error keys.

---

## โœจ Supported Languages

By default, Valida supports:

uk, en, de, es, pl, hi, fr, pt, ja

---


These are bundled with localized strings for built-in rules like `min_length`, `email`, `max`, `required`, etc.

---

## ๐Ÿงฉ Setup Guide

### 1. Add dependencies

```toml
[dependencies]
rust-i18n = { version = "" }
valida = { version = "" }
```

### 2. Enable rust-i18n in your main module

```rust
use rust_i18n::t;

rust_i18n::i18n!("locales"); // This loads all .yml files in /locales
```

# ๐Ÿ—‚ Structure for Localization Files

Your project layout should include a folder:

```toml
your_project/
  โ””โ”€โ”€ locales/
        โ”œโ”€โ”€ en.yml
        โ”œโ”€โ”€ uk.yml
        โ””โ”€โ”€ ...
```

Each YAML file contains key-value translations:

```yaml
# locales/en.yml
validator.min_length: Minimum length is %{min} characters.
age.too_young: Must be at least 18 years old.
```
You can override any built-in key or add your own.

---

# ๐Ÿง  Using Error Keys in Custom Rules

```rust
ValidationError::new("age.too_young")
```

Or with parameters:

```rust
ValidationError::new_with_params(
    "validator.max_length",
    HashMap::from([("max".to_string(), "10".to_string())])
)
```

Which resolves to:

```yaml
validator.max_length: Value must not exceed %{max} characters.
```

---


# ๐Ÿงช Runtime Localization

You can change language dynamically:

```rust
println!("{}", errors.pretty_print("uk"));
```

---

# ๐Ÿ“ฆ Overriding Messages

Simply redefine the key in your own YAML file. Valida will pick up your version if present in the selected locale.

---

# ๐Ÿง  Best Practices

* Use lowercase dotted keys: `validator.min_length`, `age.too_young`
* Define all custom rule keys in your `locales/*.yml`
* Keep parameter keys (`%{param}`) intuitive and consistent