Commit 8d560dc
committed
fix(i18n): respect Accept-Language q-values and scope middleware
Address codex review on #126:
- parseAcceptLanguage now parses q-values (default 1.0 per RFC 9110
§12.5.4), drops q=0 (explicit rejection), and selects the
highest-q supported language. Previously a header like
'en;q=0.1, ar;q=1' picked en because the loop scanned in
textual order and ignored q.
- middleware.ts now exports a matcher config that excludes
_next/static, _next/image, /api, common static asset extensions,
and crawl files. Asset and API responses no longer attach a
Set-Cookie header and remain cacheable.
Typecheck still clean.1 parent e611d6d commit 8d560dc
2 files changed
Lines changed: 35 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
22 | 26 | | |
23 | | - | |
24 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
25 | 47 | | |
26 | 48 | | |
27 | | - | |
| 49 | + | |
28 | 50 | | |
29 | | - | |
30 | 51 | | |
31 | 52 | | |
32 | 53 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
0 commit comments