11import { invoke } from "@tauri-apps/api" ;
22import { appWindow } from "@tauri-apps/api/window" ;
3- import { t } from "i18next" ;
3+ import { useTranslation } from "react- i18next" ;
44import { memo , useCallback , useMemo } from "react" ;
55import {
66 ColorValue ,
@@ -129,6 +129,7 @@ const CustomWindowTitleBarButtons = memo<CustomButtonProps>(
129129) ;
130130
131131const WindowTitleBar = memo ( ( ) => {
132+ const { t, i18n } = useTranslation ( ) ;
132133 const { theme, themeType, setTheme } = useTheme ( ) ;
133134 const { show : showSettings } = useSettingsModal ( ) ;
134135
@@ -236,6 +237,16 @@ const WindowTitleBar = memo(() => {
236237 [ themeType ]
237238 ) ;
238239
240+ const buttonTitles = useMemo ( ( ) => {
241+ return {
242+ reconnect : t ( "reconnect" ) ,
243+ settings : t ( "settings" ) ,
244+ minimize : t ( "minimize" ) ,
245+ maximize : t ( "maximize" ) ,
246+ close : t ( "close" ) ,
247+ } ;
248+ } , [ t , i18n . language ] ) ;
249+
239250 return (
240251 // @ts -ignore
241252 < View style = { containerStyles . main } >
@@ -266,7 +277,7 @@ const WindowTitleBar = memo(() => {
266277 style = { containerStyles . reconnectButton }
267278 >
268279 < Text style = { { fontSize : sc ( 18 ) } } color = "white" semibold >
269- { t ( " reconnect" ) }
280+ { buttonTitles . reconnect }
270281 </ Text >
271282 </ TouchableOpacity >
272283 </ View >
@@ -281,27 +292,27 @@ const WindowTitleBar = memo(() => {
281292 { ! IN_GAME && (
282293 < >
283294 < CustomWindowTitleBarButtons
284- title = { t ( " settings" ) }
295+ title = { buttonTitles . settings }
285296 image = { images . icons . settings }
286297 marginRight = { sc ( 16 ) }
287298 color = { theme . textSecondary }
288299 backgroundColor = { theme . itemBackgroundColor }
289300 onPress = { showSettings }
290301 />
291302 < NativeWindowTitleBarButtons
292- title = { t ( " minimize" ) }
303+ title = { buttonTitles . minimize }
293304 image = { images . icons . windowMinimize }
294305 onPress = { handleMinimize }
295306 />
296307 < NativeWindowTitleBarButtons
297- title = { t ( " maximize" ) }
308+ title = { buttonTitles . maximize }
298309 image = { images . icons . windowMaximize }
299310 onPress = { handleMaximize }
300311 />
301312 </ >
302313 ) }
303314 < NativeWindowTitleBarButtons
304- title = { t ( " close" ) }
315+ title = { buttonTitles . close }
305316 image = { images . icons . windowClose }
306317 onPress = { handleClose }
307318 />
0 commit comments