mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-22 09:57:00 +01:00
fix: 🐛 Change Page direction based on the language dir property
This commit is contained in:
parent
3e45c9d055
commit
354da4bc56
@ -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}
|
||||||
|
Loading…
Reference in New Issue
Block a user