@@ -20,6 +20,7 @@ import {
20
20
useState ,
21
21
} from "react"
22
22
import { useHotkeys } from "react-hotkeys-hook"
23
+ import { useTranslation } from "react-i18next"
23
24
import { createContext , useContext , useContextSelector } from "use-context-selector"
24
25
import { useEventCallback } from "usehooks-ts"
25
26
@@ -208,6 +209,7 @@ const FloatMutedButton = () => {
208
209
}
209
210
210
211
const ControlBar = memo ( ( ) => {
212
+ const { t } = useTranslation ( )
211
213
const controls = useContextSelector ( VideoPlayerContext , ( v ) => v . controls )
212
214
const isPaused = useContextSelector ( VideoPlayerContext , ( v ) => v . state . paused )
213
215
const dragControls = useDragControls ( )
@@ -235,7 +237,7 @@ const ControlBar = memo(() => {
235
237
236
238
< ActionIcon
237
239
shortcut = "Space"
238
- label = { isPaused ? "Play" : "Pause" }
240
+ label = { isPaused ? t ( "player.play" ) : t ( "player.pause" ) }
239
241
className = "center relative flex"
240
242
onClick = { ( ) => {
241
243
if ( isPaused ) {
@@ -268,6 +270,7 @@ const ControlBar = memo(() => {
268
270
} )
269
271
270
272
const FullScreenControl = ( ) => {
273
+ const { t } = useTranslation ( )
271
274
const ref = useContextSelector ( VideoPlayerContext , ( v ) => v . wrapperRef )
272
275
const [ isFullScreen , setIsFullScreen ] = useState ( ! ! document . fullscreenElement )
273
276
@@ -283,7 +286,7 @@ const FullScreenControl = () => {
283
286
284
287
return (
285
288
< ActionIcon
286
- label = "Full Screen"
289
+ label = { isFullScreen ? t ( "player.exit_full_screen" ) : t ( "player.full_screen" ) }
287
290
shortcut = "f"
288
291
labelDelayDuration = { 1 }
289
292
onClick = { ( ) => {
@@ -306,6 +309,7 @@ const FullScreenControl = () => {
306
309
}
307
310
308
311
const DownloadVideo = ( ) => {
312
+ const { t } = useTranslation ( )
309
313
const src = useContextSelector ( VideoPlayerContext , ( v ) => v . src )
310
314
const [ isDownloading , setIsDownloading ] = useState ( false )
311
315
const download = useEventCallback ( ( ) => {
@@ -324,7 +328,7 @@ const DownloadVideo = () => {
324
328
} )
325
329
326
330
return (
327
- < ActionIcon shortcut = "d" label = "Download" labelDelayDuration = { 1 } onClick = { download } >
331
+ < ActionIcon shortcut = "d" label = { t ( "player.download" ) } labelDelayDuration = { 1 } onClick = { download } >
328
332
{ isDownloading ? (
329
333
< i className = "i-mgc-loading-3-cute-re animate-spin" />
330
334
) : (
@@ -334,6 +338,7 @@ const DownloadVideo = () => {
334
338
)
335
339
}
336
340
const VolumeControl = ( ) => {
341
+ const { t } = useTranslation ( )
337
342
const hasAudio = useContextSelector ( VideoPlayerContext , ( v ) => v . state . hasAudio )
338
343
339
344
const controls = useContextSelector ( VideoPlayerContext , ( v ) => v . controls )
@@ -352,7 +357,11 @@ const VolumeControl = () => {
352
357
} }
353
358
labelDelayDuration = { 1 }
354
359
>
355
- { muted ? < i className = "i-mgc-volume-mute-cute-re" /> : < i className = "i-mgc-volume-cute-re" /> }
360
+ { muted ? (
361
+ < i className = "i-mgc-volume-mute-cute-re" title = { t ( "player.unmute" ) } />
362
+ ) : (
363
+ < i className = "i-mgc-volume-cute-re" title = { t ( "player.mute" ) } />
364
+ ) }
356
365
</ ActionIcon >
357
366
)
358
367
}
@@ -446,7 +455,7 @@ const ActionIcon = ({
446
455
{ children || < i className = { className } /> }
447
456
</ button >
448
457
</ TooltipTrigger >
449
- < TooltipContent className = "flex items-center gap-1 bg-theme-modal-background " >
458
+ < TooltipContent className = "flex items-center gap-1 text-xs " >
450
459
{ label }
451
460
{ shortcut && < KbdCombined > { shortcut } </ KbdCombined > }
452
461
</ TooltipContent >
0 commit comments