fix: 🐛 Change Page direction based on the language dir property
This commit is contained in:
@@ -5,6 +5,7 @@ import { ReactBasicsProvider } from 'react-basics';
|
|||||||
import ErrorBoundary from 'components/common/ErrorBoundary';
|
import ErrorBoundary from 'components/common/ErrorBoundary';
|
||||||
import { useLocale } from 'components/hooks';
|
import { useLocale } from 'components/hooks';
|
||||||
import 'chartjs-adapter-date-fns';
|
import 'chartjs-adapter-date-fns';
|
||||||
|
import { useEffect } from 'react';
|
||||||
|
|
||||||
const client = new QueryClient({
|
const client = new QueryClient({
|
||||||
defaultOptions: {
|
defaultOptions: {
|
||||||
@@ -16,7 +17,13 @@ const client = new QueryClient({
|
|||||||
});
|
});
|
||||||
|
|
||||||
function MessagesProvider({ children }) {
|
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 (
|
return (
|
||||||
<IntlProvider locale={locale} messages={messages[locale]} onError={() => null}>
|
<IntlProvider locale={locale} messages={messages[locale]} onError={() => null}>
|
||||||
{children}
|
{children}
|
||||||
|
|||||||
Reference in New Issue
Block a user