Language selection

This commit is contained in:
headlessdev
2025-04-29 20:14:44 +02:00
parent 5adb7b3967
commit 502f749151
5 changed files with 75 additions and 8 deletions

View File

@@ -1,9 +1,9 @@
import {getRequestConfig} from 'next-intl/server';
import {cookies} from 'next/headers';
export default getRequestConfig(async () => {
// Provide a static locale, fetch a user setting,
// read from `cookies()`, `headers()`, etc.
const locale = 'en';
const cookieStore = await cookies();
const locale = cookieStore.get('language')?.value || 'en';
return {
locale,