feat(i18n): static type on i18n (#2225)

This commit is contained in:
Himself65
2023-05-04 00:35:09 -05:00
committed by GitHub
parent 66c3b09c67
commit 3d43e61087
80 changed files with 585 additions and 444 deletions

View File

@@ -1,4 +1,4 @@
import { useTranslation } from '@affine/i18n';
import { useAFFiNEI18N } from '@affine/i18n/hooks';
import { Button } from '../button';
import type { ModalProps } from '../modal';
@@ -38,7 +38,7 @@ export const Confirm = ({
cancelButtonTestId = '',
confirmButtonTestId = '',
}: ConfirmProps) => {
const { t } = useTranslation();
const t = useAFFiNEI18N();
return (
<Modal open={open} disablePortal={false}>
<StyledModalWrapper>
@@ -60,7 +60,7 @@ export const Confirm = ({
style={{ marginRight: '24px' }}
data-testid={cancelButtonTestId}
>
{cancelText === 'Cancel' ? t('Cancel') : cancelText}
{cancelText === 'Cancel' ? t['Cancel']() : cancelText}
</Button>
<Button
type={confirmType}
@@ -102,7 +102,7 @@ export const Confirm = ({
}}
data-testid={cancelButtonTestId}
>
{cancelText === 'Cancel' ? t('Cancel') : cancelText}
{cancelText === 'Cancel' ? t['Cancel']() : cancelText}
</Button>
</StyledColumnButtonWrapper>
)}