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

@@ -4,7 +4,7 @@ import {
ResizeIndicator,
} from '@affine/component/app-sidebar';
import { config } from '@affine/env';
import { useTranslation } from '@affine/i18n';
import { useAFFiNEI18N } from '@affine/i18n/hooks';
import { WorkspaceFlavour } from '@affine/workspace/type';
import {
DeleteTemporarilyIcon,
@@ -67,7 +67,7 @@ export const RootAppSidebar = ({
}: RootAppSidebarProps): ReactElement => {
const currentWorkspaceId = currentWorkspace?.id || null;
const blockSuiteWorkspace = currentWorkspace?.blockSuiteWorkspace;
const { t } = useTranslation();
const t = useAFFiNEI18N();
const [isScrollAtTop, setIsScrollAtTop] = useState(true);
const onClickNewPage = useCallback(async () => {
const page = await createPage();
@@ -89,7 +89,7 @@ export const RootAppSidebar = ({
data-testid="new-page-button"
onClick={onClickNewPage}
>
<PlusIcon /> {t('New Page')}
<PlusIcon /> {t['New Page']()}
</StyledNewPageButton>
}
>
@@ -106,7 +106,7 @@ export const RootAppSidebar = ({
}, [onOpenQuickSearchModal])}
>
<SearchIcon />
{t('Quick search')}
{t['Quick search']()}
</StyledListItem>
<StyledListItem
active={
@@ -125,7 +125,7 @@ export const RootAppSidebar = ({
}}
>
<SettingsIcon />
<div>{t('Workspace Settings')}</div>
<div>{t['Workspace Settings']()}</div>
</StyledLink>
</StyledListItem>
<StyledListItem
@@ -140,7 +140,7 @@ export const RootAppSidebar = ({
}}
>
<FolderIcon />
<span data-testid="all-pages">{t('All pages')}</span>
<span data-testid="all-pages">{t['All pages']()}</span>
</StyledLink>
</StyledListItem>
<StyledScrollWrapper
@@ -190,7 +190,7 @@ export const RootAppSidebar = ({
}}
>
<ShareIcon />
<span data-testid="shared-pages">{t('Shared Pages')}</span>
<span data-testid="shared-pages">{t['Shared Pages']()}</span>
</StyledLink>
</StyledListItem>
))}
@@ -205,7 +205,7 @@ export const RootAppSidebar = ({
pathname: currentWorkspaceId && paths.trash(currentWorkspaceId),
}}
>
<DeleteTemporarilyIcon /> {t('Trash')}
<DeleteTemporarilyIcon /> {t['Trash']()}
</StyledLink>
</StyledListItem>
</StyledSliderBarInnerWrapper>