how to get the locale value in `source: "/:locale(en|fr|de)/dashboard"` inside the dashboard file
Unanswered
Western Meadowlark posted this in #help-forum
Western MeadowlarkOP
i have this structure with a /dashboard route and all of these are server side
├─ src/
│ └─ app/
│ ├─ dashboard/
│ │ ├─ layout.tsx
│ │ └─ page.tsx
│ ├─ favicon.ico
│ ├─ globals.css
│ ├─ layout.tsx
│ └─ page.tsx
I did a url rewrite in next config as
so now /en/dashboard will show me the /dashboard page.
but now lets say i want to access the locale value (en/de/fr) inside the dashboard file how should i do it, assuming i want content in the page to be dynamic based on the locale
is there a way without using
here is the repo
https://github.com/cmgchess/config-rewrites
thanks in advance 🙂
├─ src/
│ └─ app/
│ ├─ dashboard/
│ │ ├─ layout.tsx
│ │ └─ page.tsx
│ ├─ favicon.ico
│ ├─ globals.css
│ ├─ layout.tsx
│ └─ page.tsx
I did a url rewrite in next config as
rewrites: async () => {
return [
{
source: "/:locale(en|fr|de)/dashboard",
destination: "/dashboard",
},
];
},so now /en/dashboard will show me the /dashboard page.
but now lets say i want to access the locale value (en/de/fr) inside the dashboard file how should i do it, assuming i want content in the page to be dynamic based on the locale
is there a way without using
use clientheaders().get('referer') also doesnt give me what i wanthere is the repo
https://github.com/cmgchess/config-rewrites
thanks in advance 🙂