From 354da4bc560c50441ca6ea99cb108f6847d53ab3 Mon Sep 17 00:00:00 2001 From: Mohanad Alrwaihy Date: Thu, 29 Feb 2024 23:10:41 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20Change=20Page=20direction?= =?UTF-8?q?=20based=20on=20the=20language=20dir=20property?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/Providers.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/app/Providers.tsx b/src/app/Providers.tsx index 3b4e52e7..bbc10a35 100644 --- a/src/app/Providers.tsx +++ b/src/app/Providers.tsx @@ -5,6 +5,7 @@ import { ReactBasicsProvider } from 'react-basics'; import ErrorBoundary from 'components/common/ErrorBoundary'; import { useLocale } from 'components/hooks'; import 'chartjs-adapter-date-fns'; +import { useEffect } from 'react'; const client = new QueryClient({ defaultOptions: { @@ -16,7 +17,13 @@ const client = new QueryClient({ }); function MessagesProvider({ children }) { - const { locale, messages } = useLocale(); + const { locale, messages, dir } = useLocale(); + + useEffect(() => { + document.documentElement.setAttribute('dir', dir); + document.documentElement.setAttribute('lang', locale); + }, [locale, dir]); + return ( null}> {children}