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
@@ -6,7 +6,7 @@ import {
ModalWrapper,
styled,
} from '@affine/component';
import { useTranslation } from '@affine/i18n';
import { useAFFiNEI18N } from '@affine/i18n/hooks';
import type { KeyboardEvent } from 'react';
import { useCallback, useRef, useState } from 'react';
@@ -35,7 +35,7 @@ export const CreateWorkspaceModal = ({
},
[handleCreateWorkspace, workspaceName]
);
const { t } = useTranslation();
const t = useAFFiNEI18N();
return (
<Modal open={open} onClose={onClose}>
<ModalWrapper width={560} height={342} style={{ padding: '10px' }}>
@@ -49,8 +49,8 @@ export const CreateWorkspaceModal = ({
/>
</Header>
<Content>
<ContentTitle>{t('New Workspace')}</ContentTitle>
<p>{t('Workspace description')}</p>
<ContentTitle>{t['New Workspace']()}</ContentTitle>
<p>{t['Workspace description']()}</p>
<Input
ref={ref => {
if (ref) {
@@ -59,7 +59,7 @@ export const CreateWorkspaceModal = ({
}}
data-testid="create-workspace-input"
onKeyDown={handleKeyDown}
placeholder={t('Set a Workspace name')}
placeholder={t['Set a Workspace name']()}
maxLength={15}
minLength={0}
onChange={value => {
@@ -86,7 +86,7 @@ export const CreateWorkspaceModal = ({
handleCreateWorkspace();
}}
>
{t('Create')}
{t['Create']()}
</Button>
</Content>
</ModalWrapper>