mirror of
https://github.com/woodchen-ink/clash-and-dashboard.git
synced 2025-07-18 14:01:56 +08:00
Fix: Modal with i18n
This commit is contained in:
parent
145bd5353d
commit
c14ed17e14
@ -4,6 +4,7 @@ import { createPortal } from 'react-dom'
|
|||||||
import { BaseComponentProps } from '@models'
|
import { BaseComponentProps } from '@models'
|
||||||
import { Button } from '@components'
|
import { Button } from '@components'
|
||||||
import { noop } from '@lib/helper'
|
import { noop } from '@lib/helper'
|
||||||
|
import { useI18n } from '@stores'
|
||||||
import './style.scss'
|
import './style.scss'
|
||||||
|
|
||||||
interface ModalProps extends BaseComponentProps {
|
interface ModalProps extends BaseComponentProps {
|
||||||
@ -47,6 +48,9 @@ export function Modal (props: ModalProps) {
|
|||||||
children
|
children
|
||||||
} = props
|
} = props
|
||||||
|
|
||||||
|
const { useTranslation } = useI18n()
|
||||||
|
const { t } = useTranslation('Modal')
|
||||||
|
|
||||||
const portalRef = useRef<HTMLDivElement>(document.createElement('div'))
|
const portalRef = useRef<HTMLDivElement>(document.createElement('div'))
|
||||||
const maskRef = useRef<HTMLDivElement>()
|
const maskRef = useRef<HTMLDivElement>()
|
||||||
|
|
||||||
@ -79,8 +83,8 @@ export function Modal (props: ModalProps) {
|
|||||||
{
|
{
|
||||||
footer && (
|
footer && (
|
||||||
<div className="footer">
|
<div className="footer">
|
||||||
<Button onClick={() => onClose()}>取 消</Button>
|
<Button onClick={() => onClose()}>{ t('cancel') }</Button>
|
||||||
<Button type="primary" onClick={() => onOk()}>确 定</Button>
|
<Button type="primary" onClick={() => onOk()}>{ t('ok') }</Button>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -94,5 +94,9 @@ export default {
|
|||||||
collapseText: 'Collapse',
|
collapseText: 'Collapse',
|
||||||
speedTestText: 'Speed Test',
|
speedTestText: 'Speed Test',
|
||||||
breakConnectionsText: 'Close connections which include the group'
|
breakConnectionsText: 'Close connections which include the group'
|
||||||
|
},
|
||||||
|
Modal: {
|
||||||
|
ok: 'Ok',
|
||||||
|
cancel: 'Cancel'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -94,5 +94,9 @@ export default {
|
|||||||
collapseText: '收起',
|
collapseText: '收起',
|
||||||
speedTestText: '测速',
|
speedTestText: '测速',
|
||||||
breakConnectionsText: '切换时打断包含策略组的连接'
|
breakConnectionsText: '切换时打断包含策略组的连接'
|
||||||
|
},
|
||||||
|
Modal: {
|
||||||
|
ok: '确 定',
|
||||||
|
cancel: '取 消'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user