11import React , { useCallback , useState } from 'react' ;
22import { MdContentCopy , MdContentCut , MdContentPaste , MdSelectAll } from 'react-icons/md' ;
33import { ContextMenu } from '../components/common/ContextMenu' ;
4+ import { useTranslation } from '../i18n/I18nProvider' ;
45
56type InputEl = HTMLInputElement | HTMLTextAreaElement ;
67
@@ -15,6 +16,7 @@ interface State {
1516let closeActiveMenu : ( ( ) => void ) | null = null ;
1617
1718export function useInputContextMenu ( ) {
19+ const { t } = useTranslation ( ) ;
1820 const [ state , setState ] = useState < State | null > ( null ) ;
1921
2022 const onContextMenu = useCallback ( ( e : React . MouseEvent < InputEl > ) => {
@@ -42,7 +44,7 @@ export function useInputContextMenu() {
4244 onClose = { handleClose }
4345 items = { [
4446 {
45- label : 'Cut' ,
47+ label : t ( 'general.cut' ) ,
4648 icon : < MdContentCut size = { 12 } /> ,
4749 disabled : ! state . hasSelection ,
4850 onClick : ( ) => {
@@ -51,7 +53,7 @@ export function useInputContextMenu() {
5153 } ,
5254 } ,
5355 {
54- label : 'Copy' ,
56+ label : t ( 'general.copy' ) ,
5557 icon : < MdContentCopy size = { 12 } /> ,
5658 disabled : ! state . hasSelection ,
5759 onClick : ( ) => {
@@ -60,7 +62,7 @@ export function useInputContextMenu() {
6062 } ,
6163 } ,
6264 {
63- label : 'Paste' ,
65+ label : t ( 'general.paste' ) ,
6466 icon : < MdContentPaste size = { 12 } /> ,
6567 onClick : ( ) => {
6668 state . el . focus ( ) ;
@@ -70,7 +72,7 @@ export function useInputContextMenu() {
7072 { type : 'separator' as const } ,
7173 {
7274 icon : < MdSelectAll size = { 12 } /> ,
73- label : 'Select All' ,
75+ label : t ( 'general.selectAll' ) ,
7476 onClick : ( ) => {
7577 state . el . focus ( ) ;
7678 state . el . select ( ) ;
0 commit comments