Skip to content

Commit

Permalink
Accessible dir prop based on language in the <html>
Browse files Browse the repository at this point in the history
  • Loading branch information
or-schneider committed Jun 6, 2024
1 parent e27c7ea commit e90baf2
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions app/[locale]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import Footer from '@/components/Footer/Footer';
import { HOST } from '@/config/consts';
import { unstable_setRequestLocale } from 'next-intl/server';
import { NextIntlClientProvider, useMessages } from 'next-intl';
import { Locale } from '../i18n';

const birzia = Birzia({
src: [
Expand Down Expand Up @@ -60,13 +61,17 @@ export default function RootLayout({
params: { locale },
}: {
children: React.ReactNode;
params: { locale: string };
params: { locale: Locale };
}) {
unstable_setRequestLocale(locale);
const messages = useMessages();

let dir = 'ltr';
if (locale === 'he') {
dir = 'rtl';
}
return (
<html lang={locale} dir="rtl" suppressHydrationWarning={true}>
<html lang={locale} dir={dir} suppressHydrationWarning={true}>
<meta charSet="ISO-8859-1" />

<body
Expand Down

0 comments on commit e90baf2

Please sign in to comment.