From db005b73373a71ef50e22fc97d88f78f08611508 Mon Sep 17 00:00:00 2001 From: dockfries Date: Tue, 16 Dec 2025 18:00:05 +0800 Subject: [PATCH] update WindowTitleBar titles after changing language --- src/containers/WindowTitleBar.tsx | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/containers/WindowTitleBar.tsx b/src/containers/WindowTitleBar.tsx index 04d292ba..93d4443c 100644 --- a/src/containers/WindowTitleBar.tsx +++ b/src/containers/WindowTitleBar.tsx @@ -1,6 +1,6 @@ import { invoke } from "@tauri-apps/api"; import { appWindow } from "@tauri-apps/api/window"; -import { t } from "i18next"; +import { useTranslation } from "react-i18next"; import { memo, useCallback, useMemo } from "react"; import { ColorValue, @@ -129,6 +129,7 @@ const CustomWindowTitleBarButtons = memo( ); const WindowTitleBar = memo(() => { + const { t, i18n } = useTranslation(); const { theme, themeType, setTheme } = useTheme(); const { show: showSettings } = useSettingsModal(); @@ -236,6 +237,16 @@ const WindowTitleBar = memo(() => { [themeType] ); + const buttonTitles = useMemo(() => { + return { + reconnect: t("reconnect"), + settings: t("settings"), + minimize: t("minimize"), + maximize: t("maximize"), + close: t("close"), + }; + }, [t, i18n.language]); + return ( // @ts-ignore @@ -266,7 +277,7 @@ const WindowTitleBar = memo(() => { style={containerStyles.reconnectButton} > - {t("reconnect")} + {buttonTitles.reconnect} @@ -281,7 +292,7 @@ const WindowTitleBar = memo(() => { {!IN_GAME && ( <> { onPress={showSettings} /> )}