Skip to content

armgit / umami

Public Imported from GitHub
0

Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.

fix: 🐛 Change Page direction based on the language dir property

Mohanad Alrwaihy354da4bc560c
diff --git a/src/app/Providers.tsx b/src/app/Providers.tsx
index 3b4e52e70..bbc10a35c 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 (
<IntlProvider locale={locale} messages={messages[locale]} onError={() => null}>
{children}