You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’m trying to implement i18n in Fresh 2.
The goal is to support URLs both with locale prefix and without it, e.g.:
/aaa
/de/aaa
/ru/blog/some-post
I want both variants to resolve to the same route file (e.g. routes/aaa.tsx or routes/blog/[slug].tsx) without duplicating files under each locale folder.
I tried using middleware:
It correctly detects the locale from the first URL segment.
But ctx.next() still resolves against the original URL (/de/aaa) → Fresh looks for routes/de/aaa.tsx (which doesn’t exist) → 404.
Fresh doesn’t allow passing a modified Request to ctx.next(), so I cannot “rewrite” the path like in Next.js.
Questions:
Is there an official / recommended way in Fresh 2 to handle this use case?
Does the team plan to support some form of URL rewriting in middleware (so /de/aaa can transparently resolve to routes/aaa.tsx)?