fix(website/i18n): language detection not always working

This commit is contained in:
Elian Doran
2025-10-25 21:55:53 +03:00
parent 7e5c2ed79d
commit 477592d176
3 changed files with 29 additions and 2 deletions

View File

@@ -10,7 +10,7 @@ import SupportUs from './pages/SupportUs/SupportUs.js';
import { createContext } from 'preact';
import { useLayoutEffect, useState } from 'preact/hooks';
import { default as i18next, changeLanguage } from 'i18next';
import { LOCALES } from './i18n';
import { LOCALES, mapLocale } from './i18n';
import HttpApi from 'i18next-http-backend';
import { initReactI18next } from "react-i18next";
@@ -40,7 +40,7 @@ export function App(props: {repoStargazersCount: number}) {
export function LocaleProvider({ children }) {
const { path } = useLocation();
const localeId = path.split('/')[1] || navigator.language;
const localeId = mapLocale(path.split('/')[1] || navigator.language);
const [ loaded, setLoaded ] = useState(false);
useLayoutEffect(() => {