- 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
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- Spanishfr- Frenchde- Germanja- Japanese- (add more as needed)
Language Selection
Languages are detected from:
LANGenvironment variable--langcommand-line argument- Browser
Accept-Languageheader (web) - 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)