mirror of
https://github.com/zadam/trilium.git
synced 2025-11-14 09:15:50 +01:00
feat(website/i18n): get translation to actually render
This commit is contained in:
@@ -8,6 +8,8 @@ import Footer from './components/Footer.js';
|
||||
import GetStarted from './pages/GetStarted/get-started.js';
|
||||
import SupportUs from './pages/SupportUs/SupportUs.js';
|
||||
import { createContext } from 'preact';
|
||||
import { useEffect } from 'preact/hooks';
|
||||
import { changeLanguage } from 'i18next';
|
||||
|
||||
export const LocaleContext = createContext('en');
|
||||
|
||||
@@ -34,6 +36,10 @@ export function LocaleProvider({ children }) {
|
||||
const { path } = useLocation();
|
||||
const locale = path.split('/')[1] || 'en';
|
||||
|
||||
useEffect(() => {
|
||||
changeLanguage(locale);
|
||||
}, [ locale ]);
|
||||
|
||||
return (
|
||||
<LocaleContext.Provider value={locale}>
|
||||
{children}
|
||||
|
||||
Reference in New Issue
Block a user