mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 12:55:00 +00:00
Merge conflict
This commit is contained in:
@@ -11,10 +11,10 @@
|
||||
"dependencies": {
|
||||
"@affine/datacenter": "workspace:*",
|
||||
"@affine/i18n": "workspace:*",
|
||||
"@blocksuite/blocks": "0.3.1-20230109032243-37ad3ba",
|
||||
"@blocksuite/editor": "0.3.1-20230109032243-37ad3ba",
|
||||
"@blocksuite/blocks": "0.4.0-20230110112105-ef07332",
|
||||
"@blocksuite/editor": "0.4.0-20230110112105-ef07332",
|
||||
"@blocksuite/icons": "^2.0.2",
|
||||
"@blocksuite/store": "0.3.1-20230109032243-37ad3ba",
|
||||
"@blocksuite/store": "0.4.0-20230110112105-ef07332",
|
||||
"@emotion/css": "^11.10.0",
|
||||
"@emotion/react": "^11.10.4",
|
||||
"@emotion/server": "^11.10.0",
|
||||
|
||||
@@ -26,8 +26,8 @@
|
||||
"typescript": "^4.8.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"@blocksuite/blocks": "^0.3.1-20230109032243-37ad3ba",
|
||||
"@blocksuite/store": "^0.3.1-20230109032243-37ad3ba",
|
||||
"@blocksuite/blocks": "0.4.0-20230110112105-ef07332",
|
||||
"@blocksuite/store": "0.4.0-20230110112105-ef07332",
|
||||
"debug": "^4.3.4",
|
||||
"encoding": "^0.1.13",
|
||||
"firebase": "^9.15.0",
|
||||
|
||||
@@ -100,7 +100,8 @@ export class DataCenter {
|
||||
const workspace = createBlocksuiteWorkspace(workspaceMeta.id);
|
||||
|
||||
await this._mainProvider.createWorkspace(workspace, workspaceMeta);
|
||||
return workspace;
|
||||
const workspaceUnit = this._workspaceUnitCollection.find(workspaceMeta.id);
|
||||
return workspaceUnit;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -154,18 +155,23 @@ export class DataCenter {
|
||||
* @returns {Promise<BlocksuiteWorkspace>}
|
||||
*/
|
||||
public async loadWorkspace(workspaceId: string) {
|
||||
const workspaceInfo = this._workspaceUnitCollection.find(workspaceId);
|
||||
assert(workspaceInfo, 'Workspace not found');
|
||||
const currentProvider = this.providerMap.get(workspaceInfo.provider);
|
||||
const workspaceUnit = this._workspaceUnitCollection.find(workspaceId);
|
||||
assert(workspaceUnit, 'Workspace not found');
|
||||
const currentProvider = this.providerMap.get(workspaceUnit.provider);
|
||||
if (currentProvider) {
|
||||
currentProvider.closeWorkspace(workspaceId);
|
||||
}
|
||||
const provider = this.providerMap.get(workspaceInfo.provider);
|
||||
assert(provider, `provide '${workspaceInfo.provider}' is not registered`);
|
||||
this._logger(`Loading ${workspaceInfo.provider} workspace: `, workspaceId);
|
||||
const provider = this.providerMap.get(workspaceUnit.provider);
|
||||
assert(provider, `provide '${workspaceUnit.provider}' is not registered`);
|
||||
this._logger(`Loading ${workspaceUnit.provider} workspace: `, workspaceId);
|
||||
const workspace = this._getBlocksuiteWorkspace(workspaceId);
|
||||
this._workspaceInstances.set(workspaceId, workspace);
|
||||
return await provider.warpWorkspace(workspace);
|
||||
await provider.warpWorkspace(workspace);
|
||||
this._workspaceUnitCollection.workspaces.forEach(workspaceUnit => {
|
||||
workspaceUnit.setBlocksuiteWorkspace(null);
|
||||
});
|
||||
workspaceUnit.setBlocksuiteWorkspace(workspace);
|
||||
return workspaceUnit;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -30,7 +30,7 @@ export class WorkspaceUnit {
|
||||
public provider!: string;
|
||||
public syncMode: 'all' | 'core' = 'core';
|
||||
|
||||
private _blocksuiteWorkspace?: BlocksuiteWorkspace;
|
||||
private _blocksuiteWorkspace?: BlocksuiteWorkspace | null;
|
||||
|
||||
constructor(params: WorkspaceUnitCtorParams) {
|
||||
this.id = params.id;
|
||||
@@ -41,7 +41,7 @@ export class WorkspaceUnit {
|
||||
return this._blocksuiteWorkspace;
|
||||
}
|
||||
|
||||
setBlocksuiteWorkspace(blocksuiteWorkspace: BlocksuiteWorkspace) {
|
||||
setBlocksuiteWorkspace(blocksuiteWorkspace: BlocksuiteWorkspace | null) {
|
||||
if (blocksuiteWorkspace?.room !== this.id) {
|
||||
throw new Error('Workspace id inconsistent.');
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import i18next, { Resource } from 'i18next';
|
||||
import { initReactI18next, useTranslation } from 'react-i18next';
|
||||
import { Trans, initReactI18next, useTranslation } from 'react-i18next';
|
||||
import { LOCALES } from './resources/index.js';
|
||||
import type en_US from './resources/en.json';
|
||||
|
||||
@@ -21,9 +21,9 @@ declare module 'react-i18next' {
|
||||
}
|
||||
}
|
||||
|
||||
// const STORAGE_KEY = 'i18n_lng';
|
||||
const STORAGE_KEY = 'i18n_lng';
|
||||
|
||||
export { i18n, useTranslation, LOCALES };
|
||||
export { Trans, i18n, useTranslation, LOCALES };
|
||||
|
||||
const resources = LOCALES.reduce<Resource>(
|
||||
(acc, { tag, res }) => ({ ...acc, [tag]: { translation: res } }),
|
||||
@@ -33,17 +33,26 @@ const resources = LOCALES.reduce<Resource>(
|
||||
const fallbackLng = LOCALES[0].tag;
|
||||
const standardizeLocale = (language: string) => {
|
||||
if (LOCALES.find(locale => locale.tag === language)) return language;
|
||||
if (language === 'zh-CN' || language === 'zh') {
|
||||
return 'zh-Hans';
|
||||
}
|
||||
if (language.slice(0, 2).toLowerCase() === 'zh') {
|
||||
return 'zh-Hant';
|
||||
}
|
||||
if (LOCALES.find(locale => locale.tag === language.slice(0, 2).toLowerCase()))
|
||||
return language;
|
||||
return fallbackLng;
|
||||
};
|
||||
let language = 'en';
|
||||
|
||||
const language = standardizeLocale(
|
||||
// localStorage.getItem(STORAGE_KEY) ??
|
||||
// (typeof navigator !== 'undefined' ? navigator.language : 'en')
|
||||
'en'
|
||||
);
|
||||
|
||||
if (typeof window !== 'undefined') {
|
||||
const localStorageLanguage = localStorage.getItem(STORAGE_KEY);
|
||||
if (localStorageLanguage) {
|
||||
language = standardizeLocale(localStorageLanguage);
|
||||
} else {
|
||||
language = standardizeLocale(navigator.language);
|
||||
}
|
||||
}
|
||||
const i18n = i18next.createInstance();
|
||||
i18n.use(initReactI18next).init({
|
||||
lng: language,
|
||||
@@ -55,8 +64,8 @@ i18n.use(initReactI18next).init({
|
||||
},
|
||||
});
|
||||
|
||||
i18n.on('languageChanged', () => {
|
||||
// localStorage.setItem(STORAGE_KEY, lng);
|
||||
i18n.on('languageChanged', lng => {
|
||||
localStorage.setItem(STORAGE_KEY, lng);
|
||||
});
|
||||
|
||||
// const I18nProvider = I18nextProvider;
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
{
|
||||
"Quick search": "Quick search",
|
||||
"Quick search placeholder": "Quick Search...",
|
||||
"Quick search placeholder2": "Search in {{workspace}}",
|
||||
"All pages": "All pages",
|
||||
"Favourites": "Favourites",
|
||||
"No item": "No item",
|
||||
"Settings": "Settings",
|
||||
"Import": "Import",
|
||||
"Trash": "Trash",
|
||||
"New Page": "New Page",
|
||||
@@ -54,7 +57,7 @@
|
||||
"Strikethrough": "Strikethrough",
|
||||
"Inline code": "Inline code",
|
||||
"Code block": "Code block",
|
||||
"Link": "Hyperlink(with selected text)",
|
||||
"Link": "Hyperlink (with selected text)",
|
||||
"Body text": "Body text",
|
||||
"Heading": "Heading {{number}}",
|
||||
"Increase indent": "Increase indent",
|
||||
@@ -75,5 +78,66 @@
|
||||
"Restore it": "Restore it",
|
||||
"TrashButtonGroupTitle": "Permanently delete",
|
||||
"TrashButtonGroupDescription": "Once deleted, you can't undo this action. Do you confirm?",
|
||||
"Delete permanently": "Delete permanently"
|
||||
"Delete permanently": "Delete permanently",
|
||||
"recommendBrowser": " We recommend the <1>Chrome</1> browser for optimal experience.",
|
||||
"upgradeBrowser": "Please upgrade to the latest version of Chrome for the best experience.",
|
||||
"Invite Members": "Invite Members",
|
||||
"Invite placeholder": "Search mail (Gmail support only)",
|
||||
"Non-Gmail": "Non-Gmail is not supported",
|
||||
"Invite": "Invite",
|
||||
"Loading": "Loading...",
|
||||
"NotLoggedIn": "Currently not logged in",
|
||||
"ClearData": "Clear local data",
|
||||
"Continue with Google": "Continue with Google",
|
||||
"Set up an AFFiNE account to sync data": "Set up an AFFiNE account to sync data",
|
||||
"Stay logged out": "Stay logged out",
|
||||
"All changes are saved locally": "All changes are saved locally",
|
||||
"Ooops!": "Ooops!",
|
||||
"mobile device": "Looks like you are browsing on a mobile device.",
|
||||
"mobile device description": "We are still working on mobile support and recommend you use a desktop device.",
|
||||
"Got it": "Got it",
|
||||
"emptyAllPages": "This workspace is empty. Create a new page to begin editing.",
|
||||
"emptyFavourite": "Click Add to Favourites and the page will appear here.",
|
||||
"emptyTrash": "Click Add to Trash and the page will appear here.",
|
||||
"still designed": "(This page is still being designed.)",
|
||||
"My Workspaces": "My Workspaces",
|
||||
"Create Or Import": "Create Or Import",
|
||||
"Tips": "Tips: ",
|
||||
"login success": "Login success",
|
||||
"Sign in": "Sign in AFFiNE Cloud",
|
||||
"Sign out": "Sign out of AFFiNE Cloud",
|
||||
"Delete Workspace": "Delete Workspace",
|
||||
"Delete Workspace Description": "Deleting (<1>{{workspace}}</1>) cannot be undone, please proceed with caution. along with all its content.",
|
||||
"Delete Workspace Description2": "Deleting (<1>{{workspace}}</1>) will delete both local and cloud data, this operation cannot be undone, please proceed with caution.",
|
||||
"Delete Workspace placeholder": "Please type “Delete” to confirm",
|
||||
"Leave Workspace": "Leave Workspace",
|
||||
"Leave Workspace Description": "After you leave, you will not be able to access all the contents of this workspace.",
|
||||
"Leave": "Leave",
|
||||
"Workspace Icon": "Workspace Icon",
|
||||
"Workspace Name": "Workspace Name",
|
||||
"Workspace Type": "Workspace Type",
|
||||
"Export Workspace": "Export Workspace <1>{{workspace}}</1> Is Coming",
|
||||
"Users": "Users",
|
||||
"Access level": "Access level",
|
||||
"Pending": "Pending",
|
||||
"Collaboration Description": "Collaborating with other members requires AFFiNE Cloud service.",
|
||||
"Enable AFFiNE Cloud": "Enable AFFiNE Cloud",
|
||||
"Enable AFFiNE Cloud Description": "If enabled, the data in this workspace will be backed up and synchronised via AFFiNE Cloud.",
|
||||
"Enable": "Enable",
|
||||
"Sign in and Enable": "Sign in and Enable",
|
||||
"Skip": "Skip",
|
||||
"Publishing": "Publishing to web requires AFFiNE Cloud service.",
|
||||
"Share with link": "Share with link",
|
||||
"Copy Link": "Copy Link",
|
||||
"Publishing Description": "After publishing to the web, everyone can view the content of this workspace through the link.",
|
||||
"Stop publishing": "Stop publishing",
|
||||
"Publish to web": "Publish to web",
|
||||
"Sync Description": "{{workspaceName}} is Local Workspace. All data is stored on the current device. You can enable AFFiNE Cloud for this workspace to keep data in sync with the cloud.",
|
||||
"Sync Description2": "<1>{{workspaceName}}</1> is Cloud Workspace. All data will be synchronized and saved to the AFFiNE",
|
||||
"Download data to device": "Download {{CoreOrAll}} data to device",
|
||||
"General": "General",
|
||||
"Sync": "Sync",
|
||||
"Collaboration": "Collaboration",
|
||||
"Publish": "Publish",
|
||||
"Workspace Settings": "Workspace Settings"
|
||||
}
|
||||
|
||||
@@ -1,65 +1 @@
|
||||
{
|
||||
"Quick search": "快速搜索",
|
||||
"All pages": "全部页面",
|
||||
"Favourites": "收藏夹",
|
||||
"No item": "没有项目",
|
||||
"Import": "导入",
|
||||
"Trash": "回收站",
|
||||
"New Page": "新建文章",
|
||||
"New Keyword Page": "新建 '{{query}}' 为标题的文章",
|
||||
"Find 0 result": "找到 0 个结果",
|
||||
"Find results": "找到 {{number}} 个结果",
|
||||
"Collapse sidebar": "关闭侧边栏",
|
||||
"Expand sidebar": "展开侧边栏",
|
||||
"Removed from Favourites": "已从收藏中移除",
|
||||
"Remove from favourites": "从收藏中移除",
|
||||
"Added to Favourites": "已添加到收藏",
|
||||
"Add to favourites": "添加到收藏",
|
||||
"Paper": "文章",
|
||||
"Edgeless": "无边模式",
|
||||
"Switch to": "跳转到",
|
||||
"Convert to ": "转换成 ",
|
||||
"Page": "文章",
|
||||
"Export": "导出",
|
||||
"Export to HTML": "导出到 HTML",
|
||||
"Export to Markdown": "导出到 Markdown",
|
||||
"Delete": "删除",
|
||||
"Title": "标题",
|
||||
"Untitled": "无标题",
|
||||
"Created": "创建时间",
|
||||
"Updated": "更新时间",
|
||||
"Open in new tab": "在新页面打开",
|
||||
"Favourite": "收藏",
|
||||
"Favourited": "已收藏",
|
||||
"Delete page?": "删除文章?",
|
||||
"Delete permanently?": "永久删除?",
|
||||
"will be moved to Trash": "{{title}} 将被移动到回收站",
|
||||
"Once deleted, you can't undo this action.": "一次性删除,无法恢复。",
|
||||
"Moved to Trash": "已移动到回收站",
|
||||
"Permanently deleted": "已永久删除",
|
||||
"restored": "{{title}} 已恢复",
|
||||
"Cancel": "取消",
|
||||
"Keyboard Shortcuts": "快捷键",
|
||||
"Contact Us": "联系我们",
|
||||
"Official Website": "官网",
|
||||
"Get in touch!": "Get in touch!",
|
||||
"AFFiNE Community": "AFFiNE Community",
|
||||
"How is AFFiNE Alpha different?": "How is AFFiNE Alpha different?",
|
||||
"Shortcuts": "Shortcuts",
|
||||
"Undo": "Undo",
|
||||
"Redo": "Redo",
|
||||
"Bold": "Bold",
|
||||
"Italic": "Italic",
|
||||
"Underline": "Underline",
|
||||
"Strikethrough": "Strikethrough",
|
||||
"Inline code": "Inline code",
|
||||
"Code block": "Code block",
|
||||
"Link": "Link",
|
||||
"Body text": "Body text",
|
||||
"Heading": "Heading {{number}}",
|
||||
"Increase indent": "Increase indent",
|
||||
"Reduce indent": "Reduce indent",
|
||||
"Markdown Syntax": "Markdown Syntax",
|
||||
"Divider": "Divider",
|
||||
"404 - Page Not Found": "404 - Page Not Found"
|
||||
}
|
||||
{}
|
||||
|
||||
Reference in New Issue
Block a user