From 9fbc7fa379bfb64ff94b12573c235d97ef7402d9 Mon Sep 17 00:00:00 2001 From: yyh <92089059+lyzno1@users.noreply.github.com> Date: Tue, 30 Dec 2025 15:36:58 +0800 Subject: [PATCH 1/4] fix(i18n): load server namespaces by kebab-case (#30368) --- web/i18n-config/server.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/web/i18n-config/server.ts b/web/i18n-config/server.ts index 91cb2f2a6d..4912e86323 100644 --- a/web/i18n-config/server.ts +++ b/web/i18n-config/server.ts @@ -2,7 +2,7 @@ import type { i18n as I18nInstance } from 'i18next' import type { Locale } from '.' import type { NamespaceCamelCase, NamespaceKebabCase } from './i18next-config' import { match } from '@formatjs/intl-localematcher' -import { camelCase } from 'es-toolkit/compat' +import { camelCase, kebabCase } from 'es-toolkit/compat' import { createInstance } from 'i18next' import resourcesToBackend from 'i18next-resources-to-backend' import Negotiator from 'negotiator' @@ -22,8 +22,9 @@ const getOrCreateI18next = async (lng: Locale) => { instance = createInstance() await instance .use(initReactI18next) - .use(resourcesToBackend((language: Locale, namespace: NamespaceKebabCase) => { - return import(`../i18n/${language}/${namespace}.json`) + .use(resourcesToBackend((language: Locale, namespace: NamespaceCamelCase | NamespaceKebabCase) => { + const fileNamespace = kebabCase(namespace) as NamespaceKebabCase + return import(`../i18n/${language}/${fileNamespace}.json`) })) .init({ lng, From 1873b5a7665a43d54e6318f8695574a2414ea3d7 Mon Sep 17 00:00:00 2001 From: Stephen Zhou <38493346+hyoban@users.noreply.github.com> Date: Tue, 30 Dec 2025 15:37:16 +0800 Subject: [PATCH 2/4] chore: remove useless __esModule (#30366) --- web/__tests__/workflow-parallel-limit.test.tsx | 1 - .../app-sidebar/dataset-info/index.spec.tsx | 1 - .../text-squeeze-fix-verification.spec.tsx | 1 - .../annotation/add-annotation-modal/index.spec.tsx | 1 - .../batch-add-annotation-modal/index.spec.tsx | 4 ---- .../annotation/edit-annotation-modal/index.spec.tsx | 2 -- .../app/annotation/header-opts/index.spec.tsx | 1 - web/app/components/app/annotation/index.spec.tsx | 1 - web/app/components/app/annotation/list.spec.tsx | 1 - .../annotation/view-annotation-modal/index.spec.tsx | 2 -- .../config-prompt/confirm-add-var/index.spec.tsx | 1 - .../conversation-history/edit-modal.spec.tsx | 1 - .../conversation-history/history-panel.spec.tsx | 2 -- .../app/configuration/config-prompt/index.spec.tsx | 2 -- .../config/agent-setting-button.spec.tsx | 1 - .../config/agent/agent-tools/index.spec.tsx | 2 -- .../agent/agent-tools/setting-built-in-tool.spec.tsx | 1 - .../app/configuration/config/index.spec.tsx | 9 --------- .../dataset-config/card-item/index.spec.tsx | 2 -- .../app/configuration/dataset-config/index.spec.tsx | 5 ----- .../params-config/config-content.spec.tsx | 2 -- .../dataset-config/params-config/index.spec.tsx | 2 -- .../dataset-config/select-dataset/index.spec.tsx | 1 - .../dataset-config/settings-modal/index.spec.tsx | 4 ---- .../settings-modal/retrieval-section.spec.tsx | 3 --- .../debug/debug-with-multiple-model/index.spec.tsx | 6 ------ .../debug/debug-with-single-model/index.spec.tsx | 1 - .../configuration/prompt-value-panel/index.spec.tsx | 1 - .../app/create-app-dialog/app-list/index.spec.tsx | 3 --- .../components/app/create-app-modal/index.spec.tsx | 1 - .../components/app/duplicate-modal/index.spec.tsx | 1 - web/app/components/app/log-annotation/index.spec.tsx | 3 --- .../components/app/overview/embedded/index.spec.tsx | 2 -- .../components/app/switch-app-modal/index.spec.tsx | 1 - .../app/text-generate/saved-items/index.spec.tsx | 1 - web/app/components/app/workflow-log/detail.spec.tsx | 1 - web/app/components/app/workflow-log/index.spec.tsx | 3 --- web/app/components/app/workflow-log/list.spec.tsx | 5 ----- .../app/workflow-log/trigger-by-display.spec.tsx | 2 -- web/app/components/apps/app-card.spec.tsx | 2 -- web/app/components/apps/index.spec.tsx | 2 -- web/app/components/apps/list.spec.tsx | 5 ----- web/app/components/base/file-uploader/utils.spec.ts | 1 - .../billing/annotation-full/index.spec.tsx | 2 -- .../billing/annotation-full/modal.spec.tsx | 3 --- .../components/billing/billing-page/index.spec.tsx | 1 - .../billing/header-billing-btn/index.spec.tsx | 1 - .../components/billing/partner-stack/index.spec.tsx | 1 - .../billing/partner-stack/use-ps-info.spec.tsx | 1 - .../billing/plan-upgrade-modal/index.spec.tsx | 1 - web/app/components/billing/plan/index.spec.tsx | 2 -- .../pricing/plans/cloud-plan-item/index.spec.tsx | 1 - .../components/billing/pricing/plans/index.spec.tsx | 2 -- .../plans/self-hosted-plan-item/index.spec.tsx | 1 - .../trigger-events-limit-modal/index.spec.tsx | 1 - .../billing/vector-space-full/index.spec.tsx | 1 - web/app/components/custom/custom-page/index.spec.tsx | 1 - .../common/retrieval-method-config/index.spec.tsx | 1 - web/app/components/datasets/create/index.spec.tsx | 3 --- .../datasets/create/step-three/index.spec.tsx | 2 -- .../data-source/online-documents/index.spec.tsx | 1 - .../data-source/online-drive/index.spec.tsx | 1 - .../preview/chunk-preview.spec.tsx | 1 - .../embedding-process/rule-detail.spec.tsx | 1 - .../create-from-pipeline/processing/index.spec.tsx | 1 - .../detail/completed/segment-card/index.spec.tsx | 3 --- web/app/components/explore/app-list/index.spec.tsx | 2 -- .../explore/create-app-modal/index.spec.tsx | 1 - web/app/components/explore/index.spec.tsx | 2 -- .../components/explore/installed-app/index.spec.tsx | 2 -- web/app/components/explore/sidebar/index.spec.tsx | 1 - web/app/components/goto-anything/index.spec.tsx | 1 - .../share/text-generation/run-batch/index.spec.tsx | 1 - .../share/text-generation/run-once/index.spec.tsx | 3 --- web/app/components/tools/marketplace/index.spec.tsx | 2 -- .../workflow-header/chat-variable-trigger.spec.tsx | 3 --- .../workflow-header/features-trigger.spec.tsx | 12 ------------ .../components/workflow-header/index.spec.tsx | 3 --- web/context/modal-context.test.tsx | 1 - 79 files changed, 161 deletions(-) diff --git a/web/__tests__/workflow-parallel-limit.test.tsx b/web/__tests__/workflow-parallel-limit.test.tsx index 18657f4bd2..ba3840ac3e 100644 --- a/web/__tests__/workflow-parallel-limit.test.tsx +++ b/web/__tests__/workflow-parallel-limit.test.tsx @@ -64,7 +64,6 @@ vi.mock('i18next', () => ({ // Mock the useConfig hook vi.mock('@/app/components/workflow/nodes/iteration/use-config', () => ({ - __esModule: true, default: () => ({ inputs: { is_parallel: true, diff --git a/web/app/components/app-sidebar/dataset-info/index.spec.tsx b/web/app/components/app-sidebar/dataset-info/index.spec.tsx index da7eb6d7ff..9996ef2b4d 100644 --- a/web/app/components/app-sidebar/dataset-info/index.spec.tsx +++ b/web/app/components/app-sidebar/dataset-info/index.spec.tsx @@ -132,7 +132,6 @@ vi.mock('@/hooks/use-knowledge', () => ({ })) vi.mock('@/app/components/datasets/rename-modal', () => ({ - __esModule: true, default: ({ show, onClose, diff --git a/web/app/components/app-sidebar/text-squeeze-fix-verification.spec.tsx b/web/app/components/app-sidebar/text-squeeze-fix-verification.spec.tsx index 7c0c8b3aca..f7e91b3dea 100644 --- a/web/app/components/app-sidebar/text-squeeze-fix-verification.spec.tsx +++ b/web/app/components/app-sidebar/text-squeeze-fix-verification.spec.tsx @@ -13,7 +13,6 @@ vi.mock('next/navigation', () => ({ // Mock classnames utility vi.mock('@/utils/classnames', () => ({ - __esModule: true, default: (...classes: any[]) => classes.filter(Boolean).join(' '), })) diff --git a/web/app/components/app/annotation/add-annotation-modal/index.spec.tsx b/web/app/components/app/annotation/add-annotation-modal/index.spec.tsx index 6837516b3c..bad3ceefdf 100644 --- a/web/app/components/app/annotation/add-annotation-modal/index.spec.tsx +++ b/web/app/components/app/annotation/add-annotation-modal/index.spec.tsx @@ -10,7 +10,6 @@ vi.mock('@/context/provider-context', () => ({ const mockToastNotify = vi.fn() vi.mock('@/app/components/base/toast', () => ({ - __esModule: true, default: { notify: vi.fn(args => mockToastNotify(args)), }, diff --git a/web/app/components/app/annotation/batch-add-annotation-modal/index.spec.tsx b/web/app/components/app/annotation/batch-add-annotation-modal/index.spec.tsx index d7458d6b90..7fdb99fbab 100644 --- a/web/app/components/app/annotation/batch-add-annotation-modal/index.spec.tsx +++ b/web/app/components/app/annotation/batch-add-annotation-modal/index.spec.tsx @@ -8,7 +8,6 @@ import { annotationBatchImport, checkAnnotationBatchImportProgress } from '@/ser import BatchModal, { ProcessStatus } from './index' vi.mock('@/app/components/base/toast', () => ({ - __esModule: true, default: { notify: vi.fn(), }, @@ -24,14 +23,12 @@ vi.mock('@/context/provider-context', () => ({ })) vi.mock('./csv-downloader', () => ({ - __esModule: true, default: () =>
, })) let lastUploadedFile: File | undefined vi.mock('./csv-uploader', () => ({ - __esModule: true, default: ({ file, updateFile }: { file?: File, updateFile: (file?: File) => void }) => (