From fc96bb99cc5726fd3305b901d51b2900d2fb4a26 Mon Sep 17 00:00:00 2001 From: jingyang <72259332+zjy365@users.noreply.github.com> Date: Tue, 16 Jul 2024 17:56:27 +0800 Subject: [PATCH] feat: optimize i18n implementation for better localization (#2062) * feat: optimize i18n implementation for better localization * delete i18n-ally-custom-framework.yml * update common key --- .vscode/i18n-ally-custom-framework.yml | 46 ----------- .vscode/settings.json | 9 ++- package.json | 8 +- packages/web/i18n/en/common.json | 7 +- packages/web/i18n/zh/common.json | 7 +- packages/web/package.json | 8 +- pnpm-lock.yaml | 60 +++++++-------- projects/app/next-i18next.config.js | 2 +- projects/app/package.json | 8 +- .../src/components/CommunityModal/index.tsx | 7 +- projects/app/src/components/Layout/auth.tsx | 2 +- projects/app/src/components/Layout/navbar.tsx | 10 +-- .../app/src/components/Layout/navbarPhone.tsx | 8 +- .../app/src/components/Markdown/CodeLight.tsx | 2 +- .../Markdown/chat/QuestionGuide.tsx | 6 +- .../app/src/components/Markdown/index.tsx | 2 +- .../src/components/Select/AIModelSelector.tsx | 2 +- .../common/Modal/EditResourceModal.tsx | 10 +-- .../components/common/ParentPaths/index.tsx | 2 +- .../common/Textarea/MyTextarea/index.tsx | 6 +- .../common/Textarea/TagTextarea.tsx | 2 +- .../components/common/folder/MoveModal.tsx | 6 +- .../app/src/components/common/folder/Path.tsx | 2 +- .../common/folder/SelectOneResource.tsx | 2 +- .../components/common/folder/SlideCard.tsx | 16 ++-- .../core/ai/AISettingModal/index.tsx | 32 ++++---- .../core/ai/SettingLLMModel/index.tsx | 2 +- .../core/app/DatasetParamsModal.tsx | 48 +++++++----- .../core/app/DatasetSelectModal.tsx | 16 ++-- .../components/core/app/InputGuideConfig.tsx | 10 +-- .../app/src/components/core/app/QGSwitch.tsx | 2 +- .../core/app/ScheduledTriggerConfig.tsx | 21 ++--- .../app/src/components/core/app/TTSSelect.tsx | 22 +++--- projects/app/src/components/core/app/Tip.tsx | 16 ++-- .../src/components/core/app/VariableEdit.tsx | 42 +++++----- .../components/core/app/WelcomeTextConfig.tsx | 4 +- .../src/components/core/app/WhisperConfig.tsx | 22 +++--- .../ChatContainer/ChatBox/Input/ChatInput.tsx | 20 +++-- .../ChatBox/Input/InputGuideBox.tsx | 2 +- .../ChatBox/components/ChatController.tsx | 18 ++--- .../ChatBox/components/FeedbackModal.tsx | 16 ++-- .../ChatBox/components/QuoteModal.tsx | 2 +- .../ChatBox/components/ReadFeedbackModal.tsx | 4 +- .../ChatBox/components/ResponseTags.tsx | 8 +- .../components/SelectMarkCollection.tsx | 6 +- .../ChatBox/components/VariableInput.tsx | 2 +- .../core/chat/ChatContainer/ChatBox/index.tsx | 10 ++- .../PluginRunBox/components/RenderInput.tsx | 2 +- .../chat/components/WholeResponseModal.tsx | 76 ++++++++++++------- .../src/components/core/dataset/QuoteItem.tsx | 6 +- .../components/core/dataset/RawSourceBox.tsx | 2 +- .../core/dataset/SearchParamsTip.tsx | 14 ++-- .../components/core/dataset/SelectModal.tsx | 2 +- .../src/components/support/apikey/Table.tsx | 51 +++++++------ .../support/laf/LafAccountModal.tsx | 22 +++--- .../permission/ConfigPerModal/index.tsx | 10 +-- .../MemberManager/AddMemberModal.tsx | 2 +- .../MemberManager/MemberListCard.tsx | 2 +- .../MemberManager/PermissionSelect.tsx | 2 +- .../permission/PermissionTags/index.tsx | 2 +- .../support/permission/Radio/index.tsx | 8 +- .../support/user/inform/SystemMsgModal.tsx | 8 +- .../user/team/TeamManageModal/TeamCard.tsx | 14 ++-- .../user/team/TeamManageModal/TeamList.tsx | 4 +- .../components/EditInfoModal.tsx | 26 +++---- .../components/InviteModal.tsx | 12 +-- .../components/MemberTable.tsx | 8 +- .../PermissionManage/AddManager.tsx | 2 +- .../components/PermissionManage/index.tsx | 2 +- .../user/team/TeamManageModal/context.tsx | 2 +- .../support/user/team/TeamMenu/index.tsx | 6 +- .../support/user/team/TeamTagModal/index.tsx | 14 ++-- .../user/team/UpdateInviteModal/index.tsx | 16 ++-- .../wallet/NotSufficientModal/index.tsx | 8 +- .../support/wallet/QRCodePayModal.tsx | 2 +- .../wallet/StandardPlanContentList.tsx | 2 +- .../pages/account/components/BillTable.tsx | 38 +++++----- .../account/components/Individuation.tsx | 8 +- .../app/src/pages/account/components/Info.tsx | 64 ++++++++-------- .../pages/account/components/InformTable.tsx | 2 +- .../account/components/OpenAIAccountModal.tsx | 4 +- .../src/pages/account/components/PayModal.tsx | 9 ++- .../pages/account/components/Promotion.tsx | 14 ++-- .../account/components/UpdatePswModal.tsx | 8 +- .../pages/account/components/UsageDetail.tsx | 26 +++---- .../pages/account/components/UsageTable.tsx | 12 +-- .../components/standardDetailModal.tsx | 12 +-- projects/app/src/pages/account/index.tsx | 16 ++-- .../pages/app/detail/components/InfoModal.tsx | 30 ++++---- .../components/Logs/DetailLogsModal.tsx | 4 +- .../app/detail/components/Logs/index.tsx | 10 +-- .../app/detail/components/Plugin/Header.tsx | 8 +- .../Publish/FeiShu/FeiShuEditModal.tsx | 33 ++++---- .../components/Publish/FeiShu/index.tsx | 30 ++++---- .../Publish/Link/SelectUsingWayModal.tsx | 18 ++--- .../detail/components/Publish/Link/index.tsx | 65 ++++++++-------- .../app/detail/components/Publish/index.tsx | 12 +-- .../components/PublishHistoriesSlider.tsx | 6 +- .../detail/components/SimpleApp/AppCard.tsx | 16 ++-- .../detail/components/SimpleApp/ChatTest.tsx | 2 +- .../detail/components/SimpleApp/EditForm.tsx | 20 ++--- .../detail/components/SimpleApp/Header.tsx | 6 +- .../SimpleApp/components/ToolSelectModal.tsx | 26 +++---- .../app/detail/components/SimpleApp/index.tsx | 2 +- .../app/detail/components/TagsEditModal.tsx | 14 ++-- .../app/detail/components/Workflow/Header.tsx | 10 +-- .../components/WorkflowComponents/AppCard.tsx | 8 +- .../WorkflowComponents/Flow/ChatTest.tsx | 10 +-- .../Flow/NodeTemplatesModal.tsx | 12 +-- .../Flow/SelectAppModal.tsx | 4 +- .../Flow/hooks/useDebug.tsx | 4 +- .../Flow/hooks/useKeyboard.tsx | 2 +- .../Flow/hooks/useWorkflow.tsx | 6 +- .../Flow/nodes/NodeCQNode.tsx | 4 +- .../Flow/nodes/NodeCode.tsx | 4 +- .../Flow/nodes/NodeDatasetConcat.tsx | 6 +- .../nodes/NodeExtract/ExtractFieldModal.tsx | 34 ++++++--- .../Flow/nodes/NodeExtract/index.tsx | 8 +- .../Flow/nodes/NodeHttp/CurlImportModal.tsx | 10 +-- .../Flow/nodes/NodeHttp/index.tsx | 32 ++++---- .../Flow/nodes/NodeIfElse/ListItem.tsx | 4 +- .../Flow/nodes/NodeIfElse/index.tsx | 2 +- .../WorkflowComponents/Flow/nodes/NodeLaf.tsx | 14 ++-- .../nodes/NodePluginIO/InputEditModal.tsx | 44 +++++------ .../Flow/nodes/NodePluginIO/PluginInput.tsx | 4 +- .../Flow/nodes/NodePluginIO/PluginOutput.tsx | 4 +- .../Flow/nodes/NodePluginIO/VariableTable.tsx | 4 +- .../Flow/nodes/NodeSimple.tsx | 4 +- .../Flow/nodes/NodeTools.tsx | 6 +- .../Flow/nodes/NodeVariableUpdate.tsx | 12 +-- .../Flow/nodes/NodeWorkflowStart.tsx | 4 +- .../Flow/nodes/render/Handle/ToolHandle.tsx | 4 +- .../Flow/nodes/render/NodeCard.tsx | 40 +++++----- .../render/RenderInput/FieldEditModal.tsx | 2 +- .../templates/DynamicInputs/index.tsx | 2 +- .../RenderInput/templates/SelectApp.tsx | 2 +- .../RenderInput/templates/SelectDataset.tsx | 2 +- .../templates/SelectDatasetParams.tsx | 2 +- .../templates/SettingQuotePrompt.tsx | 32 ++++---- .../render/RenderOutput/FieldEditModal.tsx | 2 +- .../Flow/nodes/render/RenderOutput/index.tsx | 4 +- .../render/RenderToolInput/EditFieldModal.tsx | 12 +-- .../nodes/render/RenderToolInput/index.tsx | 4 +- .../components/WorkflowComponents/context.tsx | 4 +- .../pages/app/detail/components/context.tsx | 6 +- .../pages/app/list/components/CreateModal.tsx | 20 ++--- .../list/components/HttpPluginEditModal.tsx | 58 +++++++------- .../src/pages/app/list/components/List.tsx | 12 +-- projects/app/src/pages/app/list/index.tsx | 4 +- .../src/pages/chat/components/ChatHeader.tsx | 2 +- .../chat/components/ChatHistorySlider.tsx | 26 ++++--- .../chat/components/CustomPluginRunBox.tsx | 8 +- .../src/pages/chat/components/SliderApps.tsx | 6 +- .../src/pages/chat/components/ToolMenu.tsx | 8 +- projects/app/src/pages/chat/index.tsx | 4 +- projects/app/src/pages/chat/share.tsx | 2 +- projects/app/src/pages/chat/team.tsx | 4 +- .../dataset/component/EditFolderModal.tsx | 8 +- .../pages/dataset/component/MemberManager.tsx | 4 +- .../components/CollectionCard/Context.tsx | 6 +- .../CollectionCard/EmptyCollectionTip.tsx | 10 +-- .../components/CollectionCard/Header.tsx | 36 ++++----- .../CollectionCard/WebsiteConfig.tsx | 22 +++--- .../components/CollectionCard/index.tsx | 41 +++++----- .../dataset/detail/components/DataCard.tsx | 36 ++++----- .../detail/components/Import/Context.tsx | 34 ++++----- .../Import/commonProgress/DataProcess.tsx | 36 ++++----- .../Import/commonProgress/PreviewData.tsx | 2 +- .../Import/commonProgress/Upload.tsx | 14 ++-- .../Import/components/FileSourceSelector.tsx | 16 ++-- .../components/Import/components/Preview.tsx | 6 +- .../Import/components/RenderFiles.tsx | 6 +- .../Import/diffSource/ExternalFile.tsx | 2 +- .../Import/diffSource/FileCustomText.tsx | 12 +-- .../components/Import/diffSource/FileLink.tsx | 10 +-- .../Import/diffSource/FileLocal.tsx | 2 +- .../Import/diffSource/TableLocal.tsx | 4 +- .../pages/dataset/detail/components/Info.tsx | 40 +++++----- .../detail/components/InputDataModal.tsx | 58 ++++++++------ .../dataset/detail/components/Slider.tsx | 12 +-- .../pages/dataset/detail/components/Test.tsx | 26 ++++--- .../app/src/pages/dataset/detail/index.tsx | 2 +- .../dataset/list/component/CreateModal.tsx | 28 +++---- .../src/pages/dataset/list/component/List.tsx | 30 ++++---- .../dataset/list/component/MoveModal.tsx | 18 +++-- .../app/src/pages/dataset/list/context.tsx | 4 +- projects/app/src/pages/dataset/list/index.tsx | 10 +-- .../login/components/LoginForm/LoginForm.tsx | 26 +++---- .../login/components/LoginForm/WechatForm.tsx | 2 +- .../LoginForm/components/FormLayout.tsx | 8 +- projects/app/src/pages/login/provider.tsx | 2 +- .../src/pages/price/components/ExtraPlan.tsx | 30 ++++---- .../app/src/pages/price/components/FAQ.tsx | 2 +- .../app/src/pages/price/components/Points.tsx | 2 +- .../src/pages/price/components/Standard.tsx | 22 +++--- .../app/src/types/{i18n.d.ts => i18next.d.ts} | 13 +++- .../app/src/web/common/hooks/useCopyData.tsx | 6 +- .../app/src/web/common/hooks/useEditTitle.tsx | 4 +- .../app/src/web/common/hooks/useSpeech.ts | 4 +- projects/app/src/web/common/utils/i18n.ts | 2 +- projects/app/src/web/common/utils/voice.ts | 8 +- projects/app/src/web/core/app/utils.ts | 10 +-- .../dataset/components/SelectCollections.tsx | 10 +-- .../dataset/context/datasetPageContext.tsx | 12 +-- .../dataset/hooks/readCollectionSource.ts | 2 +- .../src/web/support/user/hooks/useSendCode.ts | 2 +- 206 files changed, 1360 insertions(+), 1277 deletions(-) delete mode 100644 .vscode/i18n-ally-custom-framework.yml rename projects/app/src/types/{i18n.d.ts => i18next.d.ts} (84%) diff --git a/.vscode/i18n-ally-custom-framework.yml b/.vscode/i18n-ally-custom-framework.yml deleted file mode 100644 index be5e4e7df92..00000000000 --- a/.vscode/i18n-ally-custom-framework.yml +++ /dev/null @@ -1,46 +0,0 @@ -# .vscode/i18n-ally-custom-framework.yml - -# An array of strings which contain Language Ids defined by VS Code -# You can check available language ids here: https://code.visualstudio.com/docs/languages/identifiers -languageIds: - - javascript - - typescript - - javascriptreact - - typescriptreact - -# An array of RegExes to find the key usage. **The key should be captured in the first match group**. -# You should unescape RegEx strings in order to fit in the YAML file -# To help with this, you can use https://www.freeformatter.com/json-escape.html -usageMatchRegex: - # The following example shows how to detect `t("your.i18n.keys")` - # the `{key}` will be placed by a proper keypath matching regex, - # you can ignore it and use your own matching rules as well - - "[^\\w\\d]t\\(['\"`]({key})['\"`]" - - "[^\\w\\d]commonT\\(['\"`]({key})['\"`]" - # 支持 appT("your.i18n.keys") - - "[^\\w\\d]appT\\(['\"`]({key})['\"`]" - # 支持 datasetT("your.i18n.keys") - - "[^\\w\\d]datasetT\\(['\"`]({key})['\"`]" - - "[^\\w\\d]fileT\\(['\"`]({key})['\"`]" - - "[^\\w\\d]publishT\\(['\"`]({key})['\"`]" - - "[^\\w\\d]workflowT\\(['\"`]({key})['\"`]" - - "[^\\w\\d]userT\\(['\"`]({key})['\"`]" - - "[^\\w\\d]chatT\\(['\"`]({key})['\"`]" - -# A RegEx to set a custom scope range. This scope will be used as a prefix when detecting keys -# and works like how the i18next framework identifies the namespace scope from the -# useTranslation() hook. -# You should unescape RegEx strings in order to fit in the YAML file -# To help with this, you can use https://www.freeformatter.com/json-escape.html -scopeRangeRegex: "useTranslation\\(\\s*\\[?\\s*['\"`](.*?)['\"`]" - -# An array of strings containing refactor templates. -# The "$1" will be replaced by the keypath specified. -# Optional: uncomment the following two lines to use - -# refactorTemplates: -# - i18n.get("$1") - - -# If set to true, only enables this custom framework (will disable all built-in frameworks) -monopoly: true \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 9bd7803db8e..e793cbcd8f6 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -7,11 +7,18 @@ "i18n-ally.localesPaths": [ "packages/web/i18n", ], - "i18n-ally.enabledParsers": ["json", "yaml", "js", "ts"], + "i18n-ally.enabledParsers": [ + "json", + "yaml", + "js", + "ts" + ], "i18n-ally.keystyle": "nested", "i18n-ally.sortKeys": true, "i18n-ally.keepFulfilled": false, "i18n-ally.sourceLanguage": "zh", // 根据此语言文件翻译其他语言文件的变量和内容 "i18n-ally.displayLanguage": "zh", // 显示语言 + "i18n-ally.namespace": true, + "i18n-ally.pathMatcher": "{locale}/{namespaces}.json", "i18n-ally.extract.targetPickingStrategy": "most-similar-by-key" } \ No newline at end of file diff --git a/package.json b/package.json index 026a9d78c8b..7aca23d2afe 100644 --- a/package.json +++ b/package.json @@ -14,11 +14,11 @@ "devDependencies": { "@chakra-ui/cli": "^2.4.1", "husky": "^8.0.3", - "i18next": "23.10.0", "lint-staged": "^13.3.0", - "next-i18next": "15.2.0", + "i18next": "23.11.5", + "next-i18next": "15.3.0", + "react-i18next": "14.1.2", "prettier": "3.2.4", - "react-i18next": "13.5.0", "zhlint": "^0.7.4" }, "lint-staged": { @@ -29,4 +29,4 @@ "node": ">=18.16.0", "pnpm": ">=9.0.0" } -} +} \ No newline at end of file diff --git a/packages/web/i18n/en/common.json b/packages/web/i18n/en/common.json index fe2d0964acb..4b4019a1515 100644 --- a/packages/web/i18n/en/common.json +++ b/packages/web/i18n/en/common.json @@ -597,8 +597,7 @@ "success": "Start syncing" } }, - "training": { - } + "training": {} }, "data": { "Auxiliary Data": "Auxiliary data", @@ -1373,7 +1372,7 @@ "Terms": "Terms of service", "Username": "Username", "Wechat": "Login with Wechat", - "Wx qr login": "Wechat QR code login" + "wx_qr_login": "Wechat QR code login" }, "team": { "Dataset usage": "Knowledge base capacity", @@ -1638,4 +1637,4 @@ } } } -} +} \ No newline at end of file diff --git a/packages/web/i18n/zh/common.json b/packages/web/i18n/zh/common.json index 539e3673cd7..ce30c736add 100644 --- a/packages/web/i18n/zh/common.json +++ b/packages/web/i18n/zh/common.json @@ -600,8 +600,7 @@ "success": "开始同步" } }, - "training": { - } + "training": {} }, "data": { "Auxiliary Data": "辅助数据", @@ -1382,7 +1381,7 @@ "Terms": "服务协议", "Username": "用户名", "Wechat": "微信登录", - "Wx qr login": "微信扫码登录" + "wx_qr_login": "微信扫码登录" }, "team": { "Dataset usage": "知识库容量", @@ -1647,4 +1646,4 @@ } } } -} +} \ No newline at end of file diff --git a/packages/web/package.json b/packages/web/package.json index d3954a6e640..d487c19216d 100644 --- a/packages/web/package.json +++ b/packages/web/package.json @@ -21,17 +21,17 @@ "ahooks": "^3.7.11", "date-fns": "2.30.0", "dayjs": "^1.11.7", - "i18next": "23.10.0", "lexical": "0.12.6", "lodash": "^4.17.21", - "next-i18next": "15.2.0", + "i18next": "23.11.5", + "next-i18next": "15.3.0", + "react-i18next": "14.1.2", "papaparse": "^5.4.1", "react": "18.3.1", "react-beautiful-dnd": "^13.1.1", "react-day-picker": "^8.7.1", "react-dom": "18.3.1", "react-hook-form": "7.43.1", - "react-i18next": "13.5.0", "react-photo-view": "^1.2.6", "use-context-selector": "^1.4.4" }, @@ -42,4 +42,4 @@ "@types/react-beautiful-dnd": "^13.1.1", "@types/react-dom": "18.3.0" } -} +} \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2a14b3c8be8..f57c2d36cd6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -15,20 +15,20 @@ importers: specifier: ^8.0.3 version: 8.0.3 i18next: - specifier: 23.10.0 - version: 23.10.0 + specifier: 23.11.5 + version: 23.11.5 lint-staged: specifier: ^13.3.0 version: 13.3.0 next-i18next: - specifier: 15.2.0 - version: 15.2.0(i18next@23.10.0)(next@14.2.3(@babel/core@7.24.8)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.77.8))(react-i18next@13.5.0(i18next@23.10.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1) + specifier: 15.3.0 + version: 15.3.0(i18next@23.11.5)(next@14.2.3(@babel/core@7.24.8)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.77.8))(react-i18next@14.1.2(i18next@23.11.5)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1) prettier: specifier: 3.2.4 version: 3.2.4 react-i18next: - specifier: 13.5.0 - version: 13.5.0(i18next@23.10.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + specifier: 14.1.2 + version: 14.1.2(i18next@23.11.5)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) zhlint: specifier: ^0.7.4 version: 0.7.4(@types/node@20.14.10)(sass@1.77.8)(terser@5.31.2)(typescript@5.5.3) @@ -288,8 +288,8 @@ importers: specifier: ^1.11.7 version: 1.11.11 i18next: - specifier: 23.10.0 - version: 23.10.0 + specifier: 23.11.5 + version: 23.11.5 lexical: specifier: 0.12.6 version: 0.12.6 @@ -297,8 +297,8 @@ importers: specifier: ^4.17.21 version: 4.17.21 next-i18next: - specifier: 15.2.0 - version: 15.2.0(i18next@23.10.0)(next@14.2.3(@babel/core@7.24.8)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.77.8))(react-i18next@13.5.0(i18next@23.10.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1) + specifier: 15.3.0 + version: 15.3.0(i18next@23.11.5)(next@14.2.3(@babel/core@7.24.8)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.77.8))(react-i18next@14.1.2(i18next@23.11.5)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1) papaparse: specifier: ^5.4.1 version: 5.4.1 @@ -318,8 +318,8 @@ importers: specifier: 7.43.1 version: 7.43.1(react@18.3.1) react-i18next: - specifier: 13.5.0 - version: 13.5.0(i18next@23.10.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + specifier: 14.1.2 + version: 14.1.2(i18next@23.11.5)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) react-photo-view: specifier: ^1.2.6 version: 1.2.6(react-dom@18.3.1(react@18.3.1))(react@18.3.1) @@ -424,8 +424,8 @@ importers: specifier: ^2.4.29 version: 2.4.29 i18next: - specifier: 23.10.0 - version: 23.10.0 + specifier: 23.11.5 + version: 23.11.5 immer: specifier: ^9.0.19 version: 9.0.21 @@ -451,8 +451,8 @@ importers: specifier: 14.2.3 version: 14.2.3(@babel/core@7.24.8)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.77.8) next-i18next: - specifier: 15.2.0 - version: 15.2.0(i18next@23.10.0)(next@14.2.3(@babel/core@7.24.8)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.77.8))(react-i18next@13.5.0(i18next@23.10.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1) + specifier: 15.3.0 + version: 15.3.0(i18next@23.11.5)(next@14.2.3(@babel/core@7.24.8)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.77.8))(react-i18next@14.1.2(i18next@23.11.5)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1) nextjs-node-loader: specifier: ^1.1.5 version: 1.1.5(webpack@5.92.1) @@ -472,8 +472,8 @@ importers: specifier: 7.43.1 version: 7.43.1(react@18.3.1) react-i18next: - specifier: 13.5.0 - version: 13.5.0(i18next@23.10.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + specifier: 14.1.2 + version: 14.1.2(i18next@23.11.5)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) react-markdown: specifier: ^8.0.7 version: 8.0.7(@types/react@18.3.1)(react@18.3.1) @@ -5479,8 +5479,8 @@ packages: i18next-fs-backend@2.3.1: resolution: {integrity: sha512-tvfXskmG/9o+TJ5Fxu54sSO5OkY6d+uMn+K6JiUGLJrwxAVfer+8V3nU8jq3ts9Pe5lXJv4b1N7foIjJ8Iy2Gg==} - i18next@23.10.0: - resolution: {integrity: sha512-/TgHOqsa7/9abUKJjdPeydoyDc0oTi/7u9F8lMSj6ufg4cbC1Oj3f/Jja7zj7WRIhEQKB7Q4eN6y68I9RDxxGQ==} + i18next@23.11.5: + resolution: {integrity: sha512-41pvpVbW9rhZPk5xjCX2TPJi2861LEig/YRhUkY+1FQ2IQPS0bKUDYnEqY8XPPbB48h1uIwLnP9iiEfuSl20CA==} iconv-lite@0.4.24: resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==} @@ -6649,8 +6649,8 @@ packages: neo-async@2.6.2: resolution: {integrity: sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==} - next-i18next@15.2.0: - resolution: {integrity: sha512-Rl5yZ4oGffsB0AjRykZ5PzNQ2M6am54MaMayldGmH/UKZisrIxk2SKEPJvaHhKlWe1qgdNi2FkodwK8sEjfEmg==} + next-i18next@15.3.0: + resolution: {integrity: sha512-bq7Cc9XJFcmGOCLnyEtHaeJ3+JJNsI/8Pkj9BaHAnhm4sZ9vNNC4ZsaqYnlRZ7VH5ypSo73fEqLK935jLsmCvQ==} engines: {node: '>=14'} peerDependencies: i18next: '>= 23.7.13' @@ -7276,8 +7276,8 @@ packages: peerDependencies: react: ^16.8.0 || ^17 || ^18 - react-i18next@13.5.0: - resolution: {integrity: sha512-CFJ5NDGJ2MUyBohEHxljOq/39NQ972rh1ajnadG9BjTk+UXbHLq4z5DKEbEQBDoIhUmmbuS/fIMJKo6VOax1HA==} + react-i18next@14.1.2: + resolution: {integrity: sha512-FSIcJy6oauJbGEXfhUgVeLzvWBhIBIS+/9c6Lj4niwKZyGaGb4V4vUbATXSlsHJDXXB+ociNxqFNiFuV1gmoqg==} peerDependencies: i18next: '>= 23.2.3' react: '>= 16.8.0' @@ -14665,7 +14665,7 @@ snapshots: i18next-fs-backend@2.3.1: {} - i18next@23.10.0: + i18next@23.11.5: dependencies: '@babel/runtime': 7.24.8 @@ -16211,17 +16211,17 @@ snapshots: neo-async@2.6.2: {} - next-i18next@15.2.0(i18next@23.10.0)(next@14.2.3(@babel/core@7.24.8)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.77.8))(react-i18next@13.5.0(i18next@23.10.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1): + next-i18next@15.3.0(i18next@23.11.5)(next@14.2.3(@babel/core@7.24.8)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.77.8))(react-i18next@14.1.2(i18next@23.11.5)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1): dependencies: '@babel/runtime': 7.24.8 '@types/hoist-non-react-statics': 3.3.5 core-js: 3.37.1 hoist-non-react-statics: 3.3.2 - i18next: 23.10.0 + i18next: 23.11.5 i18next-fs-backend: 2.3.1 next: 14.2.3(@babel/core@7.24.8)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.77.8) react: 18.3.1 - react-i18next: 13.5.0(i18next@23.10.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + react-i18next: 14.1.2(i18next@23.11.5)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) next@14.2.3(@babel/core@7.24.8)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.77.8): dependencies: @@ -16878,11 +16878,11 @@ snapshots: dependencies: react: 18.3.1 - react-i18next@13.5.0(i18next@23.10.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1): + react-i18next@14.1.2(i18next@23.11.5)(react-dom@18.3.1(react@18.3.1))(react@18.3.1): dependencies: '@babel/runtime': 7.24.8 html-parse-stringify: 3.0.1 - i18next: 23.10.0 + i18next: 23.11.5 react: 18.3.1 optionalDependencies: react-dom: 18.3.1(react@18.3.1) diff --git a/projects/app/next-i18next.config.js b/projects/app/next-i18next.config.js index 3f51da2c92a..5d84d7ecfdd 100644 --- a/projects/app/next-i18next.config.js +++ b/projects/app/next-i18next.config.js @@ -12,4 +12,4 @@ module.exports = { localePath: typeof window === 'undefined' ? require('path').resolve('../../packages/web/i18n') : '/i18n', reloadOnPrerender: process.env.NODE_ENV === 'development' -}; +} diff --git a/projects/app/package.json b/projects/app/package.json index 0b48670b837..f6f3f7dd381 100644 --- a/projects/app/package.json +++ b/projects/app/package.json @@ -35,7 +35,6 @@ "formidable": "^2.1.1", "framer-motion": "^9.0.6", "hyperdown": "^2.4.29", - "i18next": "23.10.0", "immer": "^9.0.19", "js-yaml": "^4.1.0", "jsonwebtoken": "^9.0.2", @@ -44,14 +43,15 @@ "nanoid": "^4.0.1", "next": "14.2.3", "json5": "^2.2.3", - "next-i18next": "15.2.0", "nextjs-node-loader": "^1.1.5", "nprogress": "^0.2.0", "react": "18.3.1", "react-day-picker": "^8.7.1", "react-dom": "18.3.1", "react-hook-form": "7.43.1", - "react-i18next": "13.5.0", + "i18next": "23.11.5", + "next-i18next": "15.3.0", + "react-i18next": "14.1.2", "react-markdown": "^8.0.7", "react-syntax-highlighter": "^15.5.0", "reactflow": "^11.7.4", @@ -81,4 +81,4 @@ "nextjs-node-loader": "^1.1.5", "typescript": "^5.1.3" } -} +} \ No newline at end of file diff --git a/projects/app/src/components/CommunityModal/index.tsx b/projects/app/src/components/CommunityModal/index.tsx index b30589b3769..1b2765b28d5 100644 --- a/projects/app/src/components/CommunityModal/index.tsx +++ b/projects/app/src/components/CommunityModal/index.tsx @@ -10,7 +10,12 @@ const CommunityModal = ({ onClose }: { onClose: () => void }) => { const { feConfigs } = useSystemStore(); return ( - + diff --git a/projects/app/src/components/Layout/auth.tsx b/projects/app/src/components/Layout/auth.tsx index 4129aa9569e..20053cfcb8d 100644 --- a/projects/app/src/components/Layout/auth.tsx +++ b/projects/app/src/components/Layout/auth.tsx @@ -39,7 +39,7 @@ const Auth = ({ children }: { children: JSX.Element }) => { ); toast({ status: 'warning', - title: t('support.user.Need to login') + title: t('common:support.user.Need to login') }); } } diff --git a/projects/app/src/components/Layout/navbar.tsx b/projects/app/src/components/Layout/navbar.tsx index 6d49c6937c0..c1d42cb3bf3 100644 --- a/projects/app/src/components/Layout/navbar.tsx +++ b/projects/app/src/components/Layout/navbar.tsx @@ -27,28 +27,28 @@ const Navbar = ({ unread }: { unread: number }) => { const navbarList = useMemo( () => [ { - label: t('navbar.Chat'), + label: t('common:navbar.Chat'), icon: 'core/chat/chatLight', activeIcon: 'core/chat/chatFill', link: `/chat?appId=${lastChatAppId}&chatId=${lastChatId}`, activeLink: ['/chat'] }, { - label: t('navbar.Studio'), + label: t('common:navbar.Studio'), icon: 'core/app/aiLight', activeIcon: 'core/app/aiFill', link: `/app/list`, activeLink: ['/app/list', '/app/detail'] }, { - label: t('navbar.Datasets'), + label: t('common:navbar.Datasets'), icon: 'core/dataset/datasetLight', activeIcon: 'core/dataset/datasetFill', link: `/dataset/list`, activeLink: ['/dataset/list', '/dataset/detail'] }, { - label: t('navbar.Account'), + label: t('common:navbar.Account'), icon: 'support/user/userLight', activeIcon: 'support/user/userFill', link: '/account', @@ -163,7 +163,7 @@ const Navbar = ({ unread }: { unread: number }) => { )} {(feConfigs?.docUrl || feConfigs?.chatbotUrl) && ( - + { const navbarList = useMemo( () => [ { - label: t('navbar.Chat'), + label: t('common:navbar.Chat'), icon: 'core/chat/chatLight', activeIcon: 'core/chat/chatFill', link: `/chat?appId=${lastChatAppId}&chatId=${lastChatId}`, @@ -21,7 +21,7 @@ const NavbarPhone = ({ unread }: { unread: number }) => { unread: 0 }, { - label: t('navbar.Studio'), + label: t('common:navbar.Studio'), icon: 'core/app/aiLight', activeIcon: 'core/app/aiFill', link: `/app/list`, @@ -29,7 +29,7 @@ const NavbarPhone = ({ unread }: { unread: number }) => { unread: 0 }, { - label: t('navbar.Tools'), + label: t('common:navbar.Tools'), icon: 'phoneTabbar/tool', activeIcon: 'phoneTabbar/toolFill', link: '/tools', @@ -37,7 +37,7 @@ const NavbarPhone = ({ unread }: { unread: number }) => { unread: 0 }, { - label: t('navbar.Account'), + label: t('common:navbar.Account'), icon: 'support/user/userLight', activeIcon: 'support/user/userFill', link: '/account', diff --git a/projects/app/src/components/Markdown/CodeLight.tsx b/projects/app/src/components/Markdown/CodeLight.tsx index 98a346a6c84..87541d5fcc2 100644 --- a/projects/app/src/components/Markdown/CodeLight.tsx +++ b/projects/app/src/components/Markdown/CodeLight.tsx @@ -329,7 +329,7 @@ const CodeLight = ({ {codeBoxName} copyData(String(children))} alignItems={'center'}> - {t('common.Copy')} + {t('common:common.Copy')} diff --git a/projects/app/src/components/Markdown/chat/QuestionGuide.tsx b/projects/app/src/components/Markdown/chat/QuestionGuide.tsx index 91b0c8b5895..af0e81764e3 100644 --- a/projects/app/src/components/Markdown/chat/QuestionGuide.tsx +++ b/projects/app/src/components/Markdown/chat/QuestionGuide.tsx @@ -24,7 +24,7 @@ const QuestionGuide = ({ text }: { text: string }) => { return questionGuides.length > 0 ? ( - + {questionGuides.map((text) => ( { lineHeight={0} bg={`linear-gradient(to left, white,white min(60px,100%),rgba(255,255,255,0) 80%)`} > - + { onClick={() => eventBus.emit(EventNameEnum.editQuestion, { text })} /> - + String(children), [children]); return ( - +