Jesús Pérez a963adbf5b
Some checks failed
CI / Lint (bash) (push) Has been cancelled
CI / Lint (markdown) (push) Has been cancelled
CI / Lint (nickel) (push) Has been cancelled
CI / Lint (nushell) (push) Has been cancelled
CI / Lint (rust) (push) Has been cancelled
CI / Benchmark (push) Has been cancelled
CI / Security Audit (push) Has been cancelled
CI / License Compliance (push) Has been cancelled
CI / Code Coverage (push) Has been cancelled
CI / Test (macos-latest) (push) Has been cancelled
CI / Test (ubuntu-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Build (macos-latest) (push) Has been cancelled
CI / Build (ubuntu-latest) (push) Has been cancelled
CI / Build (windows-latest) (push) Has been cancelled
feat(forms): migrate all form definitions and configs to Nickel (.ncl)
Replace all TOML form definitions in examples/ and config/ with
  type-checked Nickel equivalents. Update cli_loader to prefer .ncl
  (via nickel export) over .toml in config search order.
  TOML support retained as fallback — no breaking change.

  - El loader usa nickel export --format json + serde_json como puente — evita reimplementar un parser Nickel en Rust y aprovecha el binario ya existente.
  - El orden de búsqueda .ncl > .toml permite migración incremental: cualquier config vieja sigue funcionando sin tocarla.
  - Los contratos Nickel (| default, | String) en los configs sustituyen la validación que antes era implícita en el parsing TOML — el error llega antes (en nickel export) con mensajes más descriptivos.
2026-03-08 23:20:50 +00:00
..
2026-01-11 22:35:49 +00:00

Internationalization (i18n)

Multi-language form support examples.

Files

  • registration_i18n.toml - Registration form with i18n strings
  • test_i18n_form.toml - Test form for language support

Usage

Running with Different Languages

# English (default)
LANG=en cargo run --example test_i18n_form

# Spanish
LANG=es cargo run --example test_i18n_form

# French
LANG=fr cargo run --example test_i18n_form
```text

## Form Definition with i18n

Forms use language keys instead of hardcoded text:

```toml
[fields.email]
type = "email"
label = "fields.email.label"  # References translation key
help_text = "fields.email.help"
```text

## Translation Files

Translations are stored in `locales/` directory:

```text
locales/
├── en.json
├── es.json
├── fr.json
└── de.json
```text

## Translation Format

```json
{
  "fields": {
    "email": {
      "label": "Email Address",
      "help": "Enter your email address"
    }
  }
}
```text

## Supported Languages

Add translations by creating new locale files:
- `en` - English (default)
- `es` - Spanish
- `fr` - French
- `de` - German
- `ja` - Japanese
- (add more as needed)

## Language Selection

Languages are detected from:
1. `LANG` environment variable
2. `--lang` command-line argument
3. Browser `Accept-Language` header (web)
4. User preference in form

## Best Practices

- Use descriptive translation keys
- Keep translations organized by feature
- Include context for translators
- Test with different language lengths
- Consider RTL languages (Arabic, Hebrew)