diff --git a/src/hooks/useSetting.ts b/src/hooks/useSetting.ts index bb6ab12..40b11c8 100644 --- a/src/hooks/useSetting.ts +++ b/src/hooks/useSetting.ts @@ -1,5 +1,6 @@ import { create } from 'zustand'; import { persist } from 'zustand/middleware'; +import { languages } from '../i18n'; type Settings = { experiments: { @@ -11,6 +12,7 @@ type Settings = { cleanHandles: boolean; }; columns: string[]; + language: 'system' | keyof typeof languages; font: { family: 'system' | 'OpenDyslexic' | 'Atkinson-Hyperlegible'; size: 'system' | 'extra-small' | 'small' | 'medium' | 'large' | 'extra-large'; @@ -47,6 +49,7 @@ export const useSettings = create()( experiments: state.experiments, columns: state.columns, font: state.font, + language: state.language, }), }, ), diff --git a/src/routes/__root.tsx b/src/routes/__root.tsx index 5f34046..230f1f8 100644 --- a/src/routes/__root.tsx +++ b/src/routes/__root.tsx @@ -9,6 +9,7 @@ import { ReactQueryDevtools } from '@tanstack/react-query-devtools/production'; import { useSettings } from '../hooks/useSetting'; import { cn } from '../lib/utils'; import { Navbar } from '../components/Navbar'; +import i18n from '../i18n'; // Create a new query client instance const queryClient = new QueryClient({ @@ -54,11 +55,15 @@ export const Route = createRootRoute({ }); function Root() { - const { experiments, font } = useSettings(); + const { experiments, font, language } = useSettings(); const router = useRouterState(); const pathname = router.location.pathname; + const dir = i18n.dir(language); + return (
@@ -69,14 +68,15 @@ function RouteComponent() {