Jesús Pérez 6d045d62c9
feat(repeating-groups): implement duplicate detection across all backends
- Fix has_unique flag reading from field definition (was scanning fragment fields)
- Implement duplicate validation in CLI and TUI backends
- Add item counter update in Web backend after add/delete operations
- Refactor Web JavaScript: remove global constants, use closure-based state per group
- Store repeating group config in data-* attributes instead of global variables
- Update documentation and examples with unique = true attribute
- All backends now enforce unique items validation consistently
2025-12-21 11:38:14 +00:00
..
2025-12-18 01:11:17 +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

Form Definition with i18n

Forms use language keys instead of hardcoded text:

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

Translation Files

Translations are stored in locales/ directory:

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

Translation Format

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

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)