Skip to content

fix(404): locale-aware not-found page#8

Open
abdout wants to merge 1 commit into
mainfrom
fix/not-found-locale-aware
Open

fix(404): locale-aware not-found page#8
abdout wants to merge 1 commit into
mainfrom
fix/not-found-locale-aware

Conversation

@abdout
Copy link
Copy Markdown
Contributor

@abdout abdout commented Apr 25, 2026

Summary

  • 404 page hardcoded English dict + `/en` home link → Arabic users sent to wrong locale.
  • Reads `NEXT_LOCALE` cookie set by `proxy.ts`, validates against `i18n.locales`, falls back to default.
  • Both `errors.notFound` and `common.home` keys already exist in `ar.json` — no dictionary changes.

Changes

  • `src/app/[lang]/not-found.tsx` — added `resolveLocale` helper, dynamic locale + href

Test plan

  • Visit `/ar/this-does-not-exist` → Arabic 404, button text `الرئيسية`, link to `/ar`
  • Visit `/en/this-does-not-exist` → English 404, button `Home`, link to `/en`
  • Clear cookies, hit a non-existent root path → falls back to default locale

Closes #7

🤖 Generated with Claude Code

Reads NEXT_LOCALE from cookies (set by proxy.ts on every visit) and
falls back to the default locale. Replaces hardcoded /en link and
getDictionary('en') so Arabic users see the Arabic 404 with a button
that returns them to /ar instead of /en.

Closes #7

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 25, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
marketing Ready Ready Preview, Comment Apr 25, 2026 8:35am

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(404): locale-aware not-found page reads NEXT_LOCALE cookie

1 participant