What problem this redirect actually solves
Language detection is not a trick. It is a friction-reduction pattern for international sites.
Imagine a landing page with Spanish, English and French versions. If someone enters through the root path, sending them to the best-fitting version can save an unnecessary decision.
But the redirect should not fight the user. Once someone has chosen a language manually, that preference deserves more weight than browser defaults.
Input
The visitor arrives at `/` or another neutral entry point.
- No language fixed yet
- No stored preference yet
Decision
The app checks browser preference and actual support.
- `navigator.languages`
- supported locale map
Output
The app resolves a route or a fallback.
- `/es/`
- `/en/`
- `/fr/`