From 651eb3374c9c763715eb6316ce2108bd5a053b9a Mon Sep 17 00:00:00 2001 From: utin-francis-peter Date: Sun, 23 Jun 2024 23:33:27 +0100 Subject: [PATCH] chore: on language change when active tab is general, active tab is persisted as general --- frontend/src/settings/index.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/frontend/src/settings/index.tsx b/frontend/src/settings/index.tsx index 609b026..3969fce 100644 --- a/frontend/src/settings/index.tsx +++ b/frontend/src/settings/index.tsx @@ -12,6 +12,7 @@ import { Doc } from '../preferences/preferenceApi'; import ArrowLeft from '../assets/arrow-left.svg'; import ArrowRight from '../assets/arrow-right.svg'; import { useTranslation } from 'react-i18next'; +import i18n from '../locale/i18n'; const apiHost = import.meta.env.VITE_API_HOST || 'https://docsapi.arc53.com'; @@ -48,6 +49,11 @@ const Settings: React.FC = () => { }) .catch((error) => console.error(error)); }; + + // persist active tab as the translated version of 'general' per language change + React.useEffect(() => { + setActiveTab(t('settings.general.label')); + }, [i18n.language]); return (