refactor(layout): improve locale handling by storing cookie in a variable

fix(page): comment out ChangeLangButton component
This commit is contained in:
2025-06-01 17:24:44 +03:30
parent d691c8de41
commit b95fa02922
2 changed files with 3 additions and 2 deletions
+2 -1
View File
@@ -12,7 +12,8 @@ export default async function RootLayout({
}: Readonly<{ }: Readonly<{
children: React.ReactNode; children: React.ReactNode;
}>) { }>) {
const locale = (await cookies()).get('lang')?.value || 'en'; const cookieStore = await cookies();
const locale = cookieStore.get('lang')?.value || 'en';
return ( return (
<html lang={locale} dir={locale === 'fa' ? 'rtl' : 'ltr'}> <html lang={locale} dir={locale === 'fa' ? 'rtl' : 'ltr'}>
+1 -1
View File
@@ -19,7 +19,7 @@ export default async function Home() {
<main className="flex min-h-screen flex-col items-center justify-between p-24 text-gray-300"> <main className="flex min-h-screen flex-col items-center justify-between p-24 text-gray-300">
<span>{t('pages_home_title') as string}</span> <span>{t('pages_home_title') as string}</span>
<ChangeLangButton /> {/* <ChangeLangButton /> */}
</main> </main>
); );
} }