Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix: replace react-i18n with affine/i18n

DiamondThree9395b8989d19
diff --git a/packages/app/src/components/create-workspace/index.tsx b/packages/app/src/components/create-workspace/index.tsx
index 5f17a9efda..7f157e2b9b 100644
--- a/packages/app/src/components/create-workspace/index.tsx
+++ b/packages/app/src/components/create-workspace/index.tsx
@@ -4,7 +4,7 @@ import { Button } from '@/ui/button';
import { useState } from 'react';
import Input from '@/ui/input';
import { KeyboardEvent } from 'react';
-import { useTranslation } from 'react-i18next';
+import { useTranslation } from '@affine/i18n';
import { useWorkspaceHelper } from '@/hooks/use-workspace-helper';
import { useRouter } from 'next/router';
diff --git a/packages/app/src/components/edgeless-toolbar/index.tsx b/packages/app/src/components/edgeless-toolbar/index.tsx
index c30e9a3589..33784928b9 100644
--- a/packages/app/src/components/edgeless-toolbar/index.tsx
+++ b/packages/app/src/components/edgeless-toolbar/index.tsx
@@ -19,7 +19,7 @@ import Slide from '@mui/material/Slide';
import useCurrentPageMeta from '@/hooks/use-current-page-meta';
import { useAppState } from '@/providers/app-state-provider';
import useHistoryUpdated from '@/hooks/use-history-update';
-import { useTranslation } from 'react-i18next';
+import { useTranslation } from '@affine/i18n';
const useToolbarList1 = () => {
const { t } = useTranslation();
diff --git a/packages/app/src/components/file-upload/index.tsx b/packages/app/src/components/file-upload/index.tsx
index 090d628b22..80b089c35f 100644
--- a/packages/app/src/components/file-upload/index.tsx
+++ b/packages/app/src/components/file-upload/index.tsx
@@ -1,7 +1,7 @@
import { Button } from '@/ui/button';
import { FC, useRef, ChangeEvent, ReactElement } from 'react';
import { styled } from '@/styles';
-import { useTranslation } from 'react-i18next';
+import { useTranslation } from '@affine/i18n';
interface Props {
uploadType?: string;
children?: ReactElement;
diff --git a/packages/app/src/components/header/header-right-items/TrashButtonGroup.tsx b/packages/app/src/components/header/header-right-items/TrashButtonGroup.tsx
index 43a51afcfc..615648e975 100644
--- a/packages/app/src/components/header/header-right-items/TrashButtonGroup.tsx
+++ b/packages/app/src/components/header/header-right-items/TrashButtonGroup.tsx
@@ -4,7 +4,7 @@ import { useAppState } from '@/providers/app-state-provider';
import { useConfirm } from '@/providers/ConfirmProvider';
import { useRouter } from 'next/router';
import useCurrentPageMeta from '@/hooks/use-current-page-meta';
-import { useTranslation } from 'react-i18next';
+import { useTranslation } from '@affine/i18n';
export const TrashButtonGroup = () => {
const { permanentlyDeletePage } = usePageHelper();
diff --git a/packages/app/src/components/workspace-modal/languageMenu.tsx b/packages/app/src/components/workspace-modal/languageMenu.tsx
index 557a4f8f03..58bedcb47a 100644
--- a/packages/app/src/components/workspace-modal/languageMenu.tsx
+++ b/packages/app/src/components/workspace-modal/languageMenu.tsx
@@ -1,10 +1,10 @@
-import { LOCALES } from '@/libs/i18n/resources/index';
+import { LOCALES } from '@affine/i18n';
import UnfoldMoreIcon from '@mui/icons-material/UnfoldMore';
import type { TooltipProps } from '@mui/material';
import { styled } from '@/styles';
import { Button, Tooltip } from '@mui/material';
import { useState } from 'react';
-import { useTranslation } from 'react-i18next';
+import { useTranslation } from '@affine/i18n';
export const LanguageMenu = () => {
const { i18n } = useTranslation();
diff --git a/packages/app/src/components/workspace-slider-bar/index.tsx b/packages/app/src/components/workspace-slider-bar/index.tsx
index 5b0f304431..31c4f9b4b9 100644
--- a/packages/app/src/components/workspace-slider-bar/index.tsx
+++ b/packages/app/src/components/workspace-slider-bar/index.tsx
@@ -33,7 +33,7 @@ import useLocalStorage from '@/hooks/use-local-storage';
import usePageMetaList from '@/hooks/use-page-meta-list';
import { usePageHelper } from '@/hooks/use-page-helper';
// import { WorkspaceSetting } from '@/components/workspace-setting';
-import { useTranslation } from 'react-i18next';
+import { useTranslation } from '@affine/i18n';
import { WorkspaceSelector } from './WorkspaceSelector/WorkspaceSelector';
const FavoriteList = ({ showList }: { showList: boolean }) => {
@@ -156,7 +156,7 @@ export const WorkSpaceSliderBar = () => {
<StyledListItem active={router.asPath === paths.setting}>
<StyledLink href={{ pathname: paths.setting }}>
<SettingsIcon />
- {t('Setting')}
+ Settings
</StyledLink>
</StyledListItem>
diff --git a/packages/app/src/hooks/use-workspace-helper.ts b/packages/app/src/hooks/use-workspace-helper.ts
index 5b49a8b1e5..798c7c3831 100644
--- a/packages/app/src/hooks/use-workspace-helper.ts
+++ b/packages/app/src/hooks/use-workspace-helper.ts
@@ -27,7 +27,7 @@ export const useWorkspaceHelper = () => {
workspace: Workspace
) => {
if (name) {
- dataCenter.resetWorkspaceMeta({ name }, workspace);
+ dataCenter.updateWorkspaceMeta({ name }, workspace);
}
// if (avatar) {
// dataCenter.resetWorkspaceMeta({ avatar }, workspace);
diff --git a/packages/app/src/providers/app-state-provider/interface.ts b/packages/app/src/providers/app-state-provider/interface.ts
index db8c8ba564..4e5ec6a9b9 100644
--- a/packages/app/src/providers/app-state-provider/interface.ts
+++ b/packages/app/src/providers/app-state-provider/interface.ts
@@ -1,4 +1,4 @@
-import { DataCenter, User, Workspace } from '@affine/datacenter';
+import { DataCenter, User, WorkspaceInfo } from '@affine/datacenter';
import type { EditorContainer } from '@blocksuite/editor';
import type {
@@ -18,9 +18,9 @@ export interface PageMeta extends StorePageMeta {
export type AppStateValue = {
dataCenter: DataCenter;
user: User | null;
- workspaceList: Workspace[];
+ workspaceList: WorkspaceInfo[];
currentWorkspace: StoreWorkspace;
- currentMetaWorkSpace: Workspace | null;
+ currentMetaWorkSpace: WorkspaceInfo | null;
currentWorkspaceId: string;
pageList: PageMeta[];
currentPage: StorePage | null;