openverse
openverse copied to clipboard
Redirect unsupported locale paths to English and display notice banner
Description
This PR adds a global route middleware to handle unsupported two-letter language
paths (e.g. /cn) by redirecting users to the English version of the requested
page.
When a redirect occurs, a banner is displayed to inform users that translations are not available for the requested language code.
Changes
- Redirect unsupported two-letter locale paths to English
- Preserve the remainder of the URL path during redirect
- Store the unsupported locale in a cookie
- Display a dismissible banner explaining the redirect
- Implemented using Nuxt global middleware (SSR-safe)
Testing
- Visited
/cn→ redirected to/with banner displayed - Visited
/cn/search?q=test→ redirected to/search?q=test - Verified banner dismiss behavior
- Confirmed no console or SSR errors