diff --git a/packages/app/next.config.js b/packages/app/next.config.js index df91a7010..478bbfa12 100644 --- a/packages/app/next.config.js +++ b/packages/app/next.config.js @@ -11,7 +11,7 @@ const EDITOR_VERSION = enableDebugLocal const profileTarget = { ac: '100.85.73.88:12001', - dev: '100.85.73.88:12001', + dev: '100.77.180.48:11001', local: '127.0.0.1:3000', }; diff --git a/packages/app/package.json b/packages/app/package.json index aece2897f..9bc91a925 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -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", diff --git a/packages/data-center/package.json b/packages/data-center/package.json index 9f9fc2d86..606f6e196 100644 --- a/packages/data-center/package.json +++ b/packages/data-center/package.json @@ -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", diff --git a/packages/i18n/src/index.ts b/packages/i18n/src/index.ts index a3fd46a1d..714cc40f3 100644 --- a/packages/i18n/src/index.ts +++ b/packages/i18n/src/index.ts @@ -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( (acc, { tag, res }) => ({ ...acc, [tag]: { translation: res } }), @@ -33,17 +33,26 @@ const resources = LOCALES.reduce( 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; diff --git a/packages/i18n/src/resources/en.json b/packages/i18n/src/resources/en.json index 78dcb2fb2..761f649c1 100644 --- a/packages/i18n/src/resources/en.json +++ b/packages/i18n/src/resources/en.json @@ -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 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}}) cannot be undone, please proceed with caution. along with all its content.", + "Delete Workspace Description2": "Deleting (<1>{{workspace}}) 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}} 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}} 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" } diff --git a/packages/i18n/src/resources/zh-Hans.json b/packages/i18n/src/resources/zh-Hans.json index 47095233d..0967ef424 100644 --- a/packages/i18n/src/resources/zh-Hans.json +++ b/packages/i18n/src/resources/zh-Hans.json @@ -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" -} +{} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index cfb67189e..6f7b81fb5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -42,10 +42,10 @@ importers: specifiers: '@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 @@ -83,10 +83,10 @@ importers: dependencies: '@affine/datacenter': link:../data-center '@affine/i18n': link:../i18n - '@blocksuite/blocks': 0.3.1-20230109032243-37ad3ba_yjs@13.5.44 - '@blocksuite/editor': 0.3.1-20230109032243-37ad3ba_yjs@13.5.44 + '@blocksuite/blocks': 0.4.0-20230110112105-ef07332_yjs@13.5.44 + '@blocksuite/editor': 0.4.0-20230110112105-ef07332_yjs@13.5.44 '@blocksuite/icons': 2.0.4_w5j4k42lgipnm43s3brx6h3c34 - '@blocksuite/store': 0.3.1-20230109032243-37ad3ba_yjs@13.5.44 + '@blocksuite/store': 0.4.0-20230110112105-ef07332_yjs@13.5.44 '@emotion/css': 11.10.0 '@emotion/react': 11.10.4_w5j4k42lgipnm43s3brx6h3c34 '@emotion/server': 11.10.0_@emotion+css@11.10.0 @@ -125,8 +125,8 @@ importers: packages/data-center: specifiers: - '@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 '@playwright/test': ^1.29.1 '@types/debug': ^4.1.7 debug: ^4.3.4 @@ -142,8 +142,8 @@ importers: y-protocols: ^1.0.5 yjs: ^13.5.44 dependencies: - '@blocksuite/blocks': 0.3.1-20230109032243-37ad3ba_yjs@13.5.44 - '@blocksuite/store': 0.3.1-20230109032243-37ad3ba_yjs@13.5.44 + '@blocksuite/blocks': 0.4.0-20230110112105-ef07332_yjs@13.5.44 + '@blocksuite/store': 0.4.0-20230110112105-ef07332_yjs@13.5.44 debug: 4.3.4 encoding: 0.1.13 firebase: 9.15.0_encoding@0.1.13 @@ -1455,11 +1455,11 @@ packages: to-fast-properties: 2.0.0 dev: true - /@blocksuite/blocks/0.3.1-20230109032243-37ad3ba_yjs@13.5.44: - resolution: {integrity: sha512-UTlbk0Is7TMRBbvUyM2nivbqM/TLwRj1qArMYbOmvDGUNYadWo68cTwv/Ej2WwiKn22q4/4JHryGsv3gTCRz1Q==} + /@blocksuite/blocks/0.4.0-20230110112105-ef07332_yjs@13.5.44: + resolution: {integrity: sha512-dtwZRCWtirmheRQaITPOC/D9LZ3yFuYztqL/y2mz/BRSfHj8I71OVcX0HjFXx2TUdzhkea1GNYbp4226zZIiRA==} dependencies: - '@blocksuite/phasor': 0.3.1-20230109032243-37ad3ba_yjs@13.5.44 - '@blocksuite/store': 0.3.1-20230109032243-37ad3ba_yjs@13.5.44 + '@blocksuite/phasor': 0.4.0-20230110112105-ef07332_yjs@13.5.44 + '@blocksuite/store': 0.4.0-20230110112105-ef07332_yjs@13.5.44 '@tldraw/intersect': 1.8.0 autosize: 5.0.2 highlight.js: 11.7.0 @@ -1475,11 +1475,11 @@ packages: - yjs dev: false - /@blocksuite/editor/0.3.1-20230109032243-37ad3ba_yjs@13.5.44: - resolution: {integrity: sha512-bYbMn4EL/od+xP4K3u2kJT08kJBpK6H7b4cbRb9No3SUwgNHvvVNxia/QH1AQXyKaZQj/DHFgVxrw9GKo2GIPA==} + /@blocksuite/editor/0.4.0-20230110112105-ef07332_yjs@13.5.44: + resolution: {integrity: sha512-UqLVEZq/bKRJfe3e/Teur7grlnSo6oG55s00WSWu+nTIHnvgasIePJ6rpGC/pXwYdsuvVQnQzGesnrapNVtXqA==} dependencies: - '@blocksuite/blocks': 0.3.1-20230109032243-37ad3ba_yjs@13.5.44 - '@blocksuite/store': 0.3.1-20230109032243-37ad3ba_yjs@13.5.44 + '@blocksuite/blocks': 0.4.0-20230110112105-ef07332_yjs@13.5.44 + '@blocksuite/store': 0.4.0-20230110112105-ef07332_yjs@13.5.44 lit: 2.5.0 marked: 4.2.5 turndown: 7.1.1 @@ -1500,16 +1500,16 @@ packages: react: 18.2.0 dev: false - /@blocksuite/phasor/0.3.1-20230109032243-37ad3ba_yjs@13.5.44: - resolution: {integrity: sha512-mL1gSQ3rzrjdQSbWPtgyMXpbbl266UUjw26d0aIjkOh+iMMI6rWtmKWDoiDkO7tejIjwSNQ4w5zJOjJRIj+mSA==} + /@blocksuite/phasor/0.4.0-20230110112105-ef07332_yjs@13.5.44: + resolution: {integrity: sha512-R5j/iK7WBFSk7vSk8HEAsxDwr+xDeY7JuzdGzzwnkcOaxuM6Eea6g0vMw7DPuWDAkvlcP7JsgXLnzWgFZh7qmA==} peerDependencies: yjs: ^13 dependencies: yjs: 13.5.44 dev: false - /@blocksuite/store/0.3.1-20230109032243-37ad3ba_yjs@13.5.44: - resolution: {integrity: sha512-zOUz19jfhuhsUkx9BGEQPZWbPyD/AgX0LB7ShVRdd3YM73x25hD6tPLLz1HEV2b69XokC0P9oSru4aNomm4jkg==} + /@blocksuite/store/0.4.0-20230110112105-ef07332_yjs@13.5.44: + resolution: {integrity: sha512-NisHLf0uSyFu5DUZD13QSsp33C9vnd7Jf7jdLOAPztQ2U05NcGFopjM2InhwBmtmQSHrd/qi25PjgnAJ7/HSNQ==} peerDependencies: yjs: ^13 dependencies: