Переглянути джерело

fix: Refactor i18n config and fix plugin search box styling issue (#22945)

tags/1.7.1
Wu Tianwei 3 місяці тому
джерело
коміт
ad472d59e0
Аккаунт користувача з таким Email не знайдено
70 змінених файлів з 96 додано та 85 видалено
  1. 1
    1
      web/app/(commonLayout)/app/(appDetailLayout)/[appId]/develop/page.tsx
  2. 1
    1
      web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/settings/page.tsx
  3. 1
    1
      web/app/(commonLayout)/datasets/Doc.tsx
  4. 1
    1
      web/app/(commonLayout)/plugins/page.tsx
  5. 1
    1
      web/app/components/app/annotation/batch-add-annotation-modal/csv-downloader.tsx
  6. 1
    1
      web/app/components/app/annotation/header-opts/index.tsx
  7. 1
    1
      web/app/components/app/configuration/config/agent/agent-tools/setting-built-in-tool.tsx
  8. 1
    1
      web/app/components/app/configuration/tools/external-data-tool-modal.tsx
  9. 1
    1
      web/app/components/app/overview/settings/index.tsx
  10. 1
    1
      web/app/components/base/chat/chat-with-history/hooks.tsx
  11. 1
    1
      web/app/components/base/chat/embedded-chatbot/hooks.tsx
  12. 1
    1
      web/app/components/base/features/new-feature-panel/moderation/moderation-setting-modal.tsx
  13. 1
    1
      web/app/components/base/features/new-feature-panel/text-to-speech/index.tsx
  14. 1
    1
      web/app/components/base/features/new-feature-panel/text-to-speech/param-config-content.tsx
  15. 1
    1
      web/app/components/datasets/create/file-uploader/index.tsx
  16. 1
    3
      web/app/components/datasets/create/step-two/index.tsx
  17. 1
    1
      web/app/components/datasets/create/step-two/language-select/index.tsx
  18. 1
    1
      web/app/components/datasets/documents/detail/batch-modal/csv-downloader.tsx
  19. 1
    1
      web/app/components/develop/doc.tsx
  20. 1
    1
      web/app/components/header/account-setting/language-page/index.tsx
  21. 1
    1
      web/app/components/header/account-setting/members-page/index.tsx
  22. 1
    1
      web/app/components/header/account-setting/model-provider-page/install-from-marketplace.tsx
  23. 1
    1
      web/app/components/header/account-setting/model-provider-page/model-icon/index.tsx
  24. 1
    1
      web/app/components/header/account-setting/model-provider-page/provider-icon/index.tsx
  25. 1
    1
      web/app/components/header/maintenance-notice.tsx
  26. 1
    1
      web/app/components/i18n-server.tsx
  27. 2
    2
      web/app/components/i18n.tsx
  28. 2
    2
      web/app/components/plugins/card/index.tsx
  29. 1
    1
      web/app/components/plugins/marketplace/description/index.tsx
  30. 4
    4
      web/app/components/plugins/marketplace/hooks.ts
  31. 1
    1
      web/app/components/plugins/marketplace/intersection-line/hooks.ts
  32. 1
    1
      web/app/components/plugins/marketplace/list/list-with-collection.tsx
  33. 3
    1
      web/app/components/plugins/marketplace/search-box/index.tsx
  34. 2
    1
      web/app/components/plugins/marketplace/search-box/search-box-wrapper.tsx
  35. 1
    1
      web/app/components/plugins/plugin-detail-panel/model-selector/tts-params-panel.tsx
  36. 1
    1
      web/app/components/plugins/plugin-detail-panel/strategy-detail.tsx
  37. 1
    1
      web/app/components/plugins/plugin-detail-panel/strategy-item.tsx
  38. 1
    1
      web/app/components/plugins/reference-setting-modal/auto-update-setting/tool-item.tsx
  39. 1
    1
      web/app/components/plugins/types.ts
  40. 1
    1
      web/app/components/plugins/utils.ts
  41. 1
    1
      web/app/components/share/text-generation/index.tsx
  42. 1
    1
      web/app/components/tools/add-tool-modal/category.tsx
  43. 1
    1
      web/app/components/tools/edit-custom-collection-modal/test-api.tsx
  44. 1
    1
      web/app/components/tools/marketplace/index.tsx
  45. 1
    1
      web/app/components/tools/mcp/create-card.tsx
  46. 1
    1
      web/app/components/tools/mcp/detail/tool-item.tsx
  47. 1
    1
      web/app/components/tools/provider/custom-create-card.tsx
  48. 1
    1
      web/app/components/tools/provider/detail.tsx
  49. 1
    1
      web/app/components/tools/provider/tool-item.tsx
  50. 1
    1
      web/app/components/workflow/nodes/agent/default.ts
  51. 1
    1
      web/app/components/workflow/nodes/document-extractor/panel.tsx
  52. 2
    2
      web/app/dev-only/i18n-checker/page.tsx
  53. 1
    1
      web/app/layout.tsx
  54. 2
    2
      web/app/signin/_header.tsx
  55. 1
    1
      web/app/signin/invite-settings/page.tsx
  56. 1
    1
      web/app/signin/oneMoreStep.tsx
  57. 2
    2
      web/context/i18n.ts
  58. 1
    1
      web/hooks/use-i18n.ts
  59. 0
    0
      web/i18n-config/DEV.md
  60. 0
    0
      web/i18n-config/README.md
  61. 0
    1
      web/i18n-config/auto-gen-i18n.js
  62. 0
    1
      web/i18n-config/check-i18n.js
  63. 21
    9
      web/i18n-config/i18next-config.ts
  64. 2
    2
      web/i18n-config/index.ts
  65. 0
    0
      web/i18n-config/language.ts
  66. 0
    0
      web/i18n-config/languages.json
  67. 1
    1
      web/i18n-config/server.ts
  68. 1
    1
      web/models/common.ts
  69. 1
    1
      web/models/share.ts
  70. 1
    1
      web/types/app.ts

+ 1
- 1
web/app/(commonLayout)/app/(appDetailLayout)/[appId]/develop/page.tsx Переглянути файл

@@ -1,5 +1,5 @@
import React from 'react'
import type { Locale } from '@/i18n'
import type { Locale } from '@/i18n-config'
import DevelopMain from '@/app/components/develop'

export type IDevelopProps = {

+ 1
- 1
web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/settings/page.tsx Переглянути файл

@@ -1,5 +1,5 @@
import React from 'react'
import { getLocaleOnServer, useTranslation as translate } from '@/i18n/server'
import { getLocaleOnServer, useTranslation as translate } from '@/i18n-config/server'
import Form from '@/app/components/datasets/settings/form'

const Settings = async () => {

+ 1
- 1
web/app/(commonLayout)/datasets/Doc.tsx Переглянути файл

@@ -8,7 +8,7 @@ import TemplateEn from './template/template.en.mdx'
import TemplateZh from './template/template.zh.mdx'
import TemplateJa from './template/template.ja.mdx'
import I18n from '@/context/i18n'
import { LanguagesSupported } from '@/i18n/language'
import { LanguagesSupported } from '@/i18n-config/language'
import useTheme from '@/hooks/use-theme'
import { Theme } from '@/types/app'
import cn from '@/utils/classnames'

+ 1
- 1
web/app/(commonLayout)/plugins/page.tsx Переглянути файл

@@ -1,7 +1,7 @@
import PluginPage from '@/app/components/plugins/plugin-page'
import PluginsPanel from '@/app/components/plugins/plugin-page/plugins-panel'
import Marketplace from '@/app/components/plugins/marketplace'
import { getLocaleOnServer } from '@/i18n/server'
import { getLocaleOnServer } from '@/i18n-config/server'

const PluginList = async () => {
const locale = await getLocaleOnServer()

+ 1
- 1
web/app/components/app/annotation/batch-add-annotation-modal/csv-downloader.tsx Переглянути файл

@@ -8,7 +8,7 @@ import { useTranslation } from 'react-i18next'
import { useContext } from 'use-context-selector'
import { Download02 as DownloadIcon } from '@/app/components/base/icons/src/vender/solid/general'
import I18n from '@/context/i18n'
import { LanguagesSupported } from '@/i18n/language'
import { LanguagesSupported } from '@/i18n-config/language'

const CSV_TEMPLATE_QA_EN = [
['question', 'answer'],

+ 1
- 1
web/app/components/app/annotation/header-opts/index.tsx Переглянути файл

@@ -22,7 +22,7 @@ import { ChevronRight } from '@/app/components/base/icons/src/vender/line/arrows

import I18n from '@/context/i18n'
import { fetchExportAnnotationList } from '@/service/annotation'
import { LanguagesSupported } from '@/i18n/language'
import { LanguagesSupported } from '@/i18n-config/language'

const CSV_HEADER_QA_EN = ['Question', 'Answer']
const CSV_HEADER_QA_CN = ['问题', '答案']

+ 1
- 1
web/app/components/app/configuration/config/agent/agent-tools/setting-built-in-tool.tsx Переглянути файл

@@ -21,7 +21,7 @@ import type { Collection, Tool } from '@/app/components/tools/types'
import { CollectionType } from '@/app/components/tools/types'
import { fetchBuiltInToolList, fetchCustomToolList, fetchModelToolList, fetchWorkflowToolList } from '@/service/tools'
import I18n from '@/context/i18n'
import { getLanguage } from '@/i18n/language'
import { getLanguage } from '@/i18n-config/language'
import cn from '@/utils/classnames'
import type { ToolWithProvider } from '@/app/components/workflow/types'
import {

+ 1
- 1
web/app/components/app/configuration/tools/external-data-tool-modal.tsx Переглянути файл

@@ -12,7 +12,7 @@ import { BookOpen01 } from '@/app/components/base/icons/src/vender/line/educatio
import { fetchCodeBasedExtensionList } from '@/service/common'
import { SimpleSelect } from '@/app/components/base/select'
import I18n from '@/context/i18n'
import { LanguagesSupported } from '@/i18n/language'
import { LanguagesSupported } from '@/i18n-config/language'
import type {
CodeBasedExtensionItem,
ExternalDataTool,

+ 1
- 1
web/app/components/app/overview/settings/index.tsx Переглянути файл

@@ -18,7 +18,7 @@ import { SimpleSelect } from '@/app/components/base/select'
import type { AppDetailResponse } from '@/models/app'
import type { AppIconType, AppSSO, Language } from '@/types/app'
import { useToastContext } from '@/app/components/base/toast'
import { languages } from '@/i18n/language'
import { languages } from '@/i18n-config/language'
import Tooltip from '@/app/components/base/tooltip'
import { useProviderContext } from '@/context/provider-context'
import { useModalContext } from '@/context/modal-context'

+ 1
- 1
web/app/components/base/chat/chat-with-history/hooks.tsx Переглянути файл

@@ -35,7 +35,7 @@ import type {
ConversationItem,
} from '@/models/share'
import { useToastContext } from '@/app/components/base/toast'
import { changeLanguage } from '@/i18n/i18next-config'
import { changeLanguage } from '@/i18n-config/i18next-config'
import { useAppFavicon } from '@/hooks/use-app-favicon'
import { InputVarType } from '@/app/components/workflow/types'
import { TransferMethod } from '@/types/app'

+ 1
- 1
web/app/components/base/chat/embedded-chatbot/hooks.tsx Переглянути файл

@@ -31,7 +31,7 @@ import type {
ConversationItem,
} from '@/models/share'
import { useToastContext } from '@/app/components/base/toast'
import { changeLanguage } from '@/i18n/i18next-config'
import { changeLanguage } from '@/i18n-config/i18next-config'
import { InputVarType } from '@/app/components/workflow/types'
import { TransferMethod } from '@/types/app'
import { addFileInfos, sortAgentSorts } from '@/app/components/tools/utils'

+ 1
- 1
web/app/components/base/features/new-feature-panel/moderation/moderation-setting-modal.tsx Переглянути файл

@@ -19,7 +19,7 @@ import {
} from '@/service/common'
import type { CodeBasedExtensionItem } from '@/models/common'
import I18n from '@/context/i18n'
import { LanguagesSupported } from '@/i18n/language'
import { LanguagesSupported } from '@/i18n-config/language'
import { InfoCircle } from '@/app/components/base/icons/src/vender/line/general'
import { useModalContext } from '@/context/modal-context'
import { CustomConfigurationStatusEnum } from '@/app/components/header/account-setting/model-provider-page/declarations'

+ 1
- 1
web/app/components/base/features/new-feature-panel/text-to-speech/index.tsx Переглянути файл

@@ -9,7 +9,7 @@ import VoiceSettings from '@/app/components/base/features/new-feature-panel/text
import { useFeatures, useFeaturesStore } from '@/app/components/base/features/hooks'
import type { OnFeaturesChange } from '@/app/components/base/features/types'
import { FeatureEnum } from '@/app/components/base/features/types'
import { languages } from '@/i18n/language'
import { languages } from '@/i18n-config/language'
import { TtsAutoPlay } from '@/types/app'

type Props = {

+ 1
- 1
web/app/components/base/features/new-feature-panel/text-to-speech/param-config-content.tsx Переглянути файл

@@ -13,7 +13,7 @@ import { fetchAppVoices } from '@/service/apps'
import Tooltip from '@/app/components/base/tooltip'
import Switch from '@/app/components/base/switch'
import AudioBtn from '@/app/components/base/audio-btn'
import { languages } from '@/i18n/language'
import { languages } from '@/i18n-config/language'
import { TtsAutoPlay } from '@/types/app'
import type { OnFeaturesChange } from '@/app/components/base/features/types'
import classNames from '@/utils/classnames'

+ 1
- 1
web/app/components/datasets/create/file-uploader/index.tsx Переглянути файл

@@ -14,7 +14,7 @@ import { upload } from '@/service/base'
import { fetchFileUploadConfig } from '@/service/common'
import { fetchSupportFileTypes } from '@/service/datasets'
import I18n from '@/context/i18n'
import { LanguagesSupported } from '@/i18n/language'
import { LanguagesSupported } from '@/i18n-config/language'
import { IS_CE_EDITION } from '@/config'
import { Theme } from '@/types/app'
import useTheme from '@/hooks/use-theme'

+ 1
- 3
web/app/components/datasets/create/step-two/index.tsx Переглянути файл

@@ -47,7 +47,7 @@ import I18n from '@/context/i18n'
import { RETRIEVE_METHOD } from '@/types/app'
import useBreakpoints, { MediaType } from '@/hooks/use-breakpoints'
import { useDefaultModel, useModelList, useModelListAndDefaultModelAndCurrentProviderAndModel } from '@/app/components/header/account-setting/model-provider-page/hooks'
import { LanguagesSupported } from '@/i18n/language'
import { LanguagesSupported } from '@/i18n-config/language'
import ModelSelector from '@/app/components/header/account-setting/model-provider-page/model-selector'
import type { DefaultModel } from '@/app/components/header/account-setting/model-provider-page/declarations'
import { ModelTypeEnum } from '@/app/components/header/account-setting/model-provider-page/declarations'
@@ -405,7 +405,6 @@ const StepTwo = ({
score_threshold_enabled: false,
score_threshold: 0.5,
})
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [rerankDefaultModel, isRerankDefaultModelValid])

const getCreationParams = () => {
@@ -596,7 +595,6 @@ const StepTwo = ({
getRulesFromDetail()
getDefaultMode()
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [])

useEffect(() => {

+ 1
- 1
web/app/components/datasets/create/step-two/language-select/index.tsx Переглянути файл

@@ -4,7 +4,7 @@ import React from 'react'
import { RiArrowDownSLine, RiCheckLine } from '@remixicon/react'
import cn from '@/utils/classnames'
import Popover from '@/app/components/base/popover'
import { languages } from '@/i18n/language'
import { languages } from '@/i18n-config/language'

export type ILanguageSelectProps = {
currentLanguage: string

+ 1
- 1
web/app/components/datasets/documents/detail/batch-modal/csv-downloader.tsx Переглянути файл

@@ -9,7 +9,7 @@ import { useContext } from 'use-context-selector'
import { Download02 as DownloadIcon } from '@/app/components/base/icons/src/vender/solid/general'
import { ChunkingMode } from '@/models/datasets'
import I18n from '@/context/i18n'
import { LanguagesSupported } from '@/i18n/language'
import { LanguagesSupported } from '@/i18n-config/language'

const CSV_TEMPLATE_QA_EN = [
['question', 'answer'],

+ 1
- 1
web/app/components/develop/doc.tsx Переглянути файл

@@ -16,7 +16,7 @@ import TemplateChatEn from './template/template_chat.en.mdx'
import TemplateChatZh from './template/template_chat.zh.mdx'
import TemplateChatJa from './template/template_chat.ja.mdx'
import I18n from '@/context/i18n'
import { LanguagesSupported } from '@/i18n/language'
import { LanguagesSupported } from '@/i18n-config/language'
import useTheme from '@/hooks/use-theme'
import { Theme } from '@/types/app'
import cn from '@/utils/classnames'

+ 1
- 1
web/app/components/header/account-setting/language-page/index.tsx Переглянути файл

@@ -10,7 +10,7 @@ import { updateUserProfile } from '@/service/common'
import { ToastContext } from '@/app/components/base/toast'
import I18n from '@/context/i18n'
import { timezones } from '@/utils/timezone'
import { languages } from '@/i18n/language'
import { languages } from '@/i18n-config/language'

const titleClassName = `
mb-2 system-sm-semibold text-text-secondary

+ 1
- 1
web/app/components/header/account-setting/members-page/index.tsx Переглянути файл

@@ -20,7 +20,7 @@ import { Plan } from '@/app/components/billing/type'
import Button from '@/app/components/base/button'
import UpgradeBtn from '@/app/components/billing/upgrade-btn'
import { NUM_INFINITE } from '@/app/components/billing/config'
import { LanguagesSupported } from '@/i18n/language'
import { LanguagesSupported } from '@/i18n-config/language'
import cn from '@/utils/classnames'
import Tooltip from '@/app/components/base/tooltip'
import { RiPencilLine } from '@remixicon/react'

+ 1
- 1
web/app/components/header/account-setting/model-provider-page/install-from-marketplace.tsx Переглянути файл

@@ -18,7 +18,7 @@ import ProviderCard from '@/app/components/plugins/provider-card'
import List from '@/app/components/plugins/marketplace/list'
import type { Plugin } from '@/app/components/plugins/types'
import cn from '@/utils/classnames'
import { getLocaleOnClient } from '@/i18n'
import { getLocaleOnClient } from '@/i18n-config'
import { getMarketplaceUrl } from '@/utils/var'

type InstallFromMarketplaceProps = {

+ 1
- 1
web/app/components/header/account-setting/model-provider-page/model-icon/index.tsx Переглянути файл

@@ -7,7 +7,7 @@ import { useLanguage } from '../hooks'
import { Group } from '@/app/components/base/icons/src/vender/other'
import { OpenaiBlue, OpenaiTeal, OpenaiViolet, OpenaiYellow } from '@/app/components/base/icons/src/public/llm'
import cn from '@/utils/classnames'
import { renderI18nObject } from '@/i18n'
import { renderI18nObject } from '@/i18n-config'

type ModelIconProps = {
provider?: Model | ModelProvider

+ 1
- 1
web/app/components/header/account-setting/model-provider-page/provider-icon/index.tsx Переглянути файл

@@ -3,7 +3,7 @@ import type { ModelProvider } from '../declarations'
import { useLanguage } from '../hooks'
import { Openai } from '@/app/components/base/icons/src/vender/other'
import { AnthropicDark, AnthropicLight } from '@/app/components/base/icons/src/public/llm'
import { renderI18nObject } from '@/i18n'
import { renderI18nObject } from '@/i18n-config'
import { Theme } from '@/types/app'
import cn from '@/utils/classnames'
import useTheme from '@/hooks/use-theme'

+ 1
- 1
web/app/components/header/maintenance-notice.tsx Переглянути файл

@@ -1,6 +1,6 @@
import { useState } from 'react'
import { X } from '@/app/components/base/icons/src/vender/line/general'
import { NOTICE_I18N } from '@/i18n/language'
import { NOTICE_I18N } from '@/i18n-config/language'
import { useLanguage } from '@/app/components/header/account-setting/model-provider-page/hooks'

const MaintenanceNotice = () => {

+ 1
- 1
web/app/components/i18n-server.tsx Переглянути файл

@@ -1,7 +1,7 @@
import React from 'react'
import I18N from './i18n'
import { ToastProvider } from './base/toast'
import { getLocaleOnServer } from '@/i18n/server'
import { getLocaleOnServer } from '@/i18n-config/server'

export type II18NServerProps = {
children: React.ReactNode

+ 2
- 2
web/app/components/i18n.tsx Переглянути файл

@@ -3,8 +3,8 @@
import type { FC } from 'react'
import React, { useEffect, useState } from 'react'
import I18NContext from '@/context/i18n'
import type { Locale } from '@/i18n'
import { setLocaleOnClient } from '@/i18n'
import type { Locale } from '@/i18n-config'
import { setLocaleOnClient } from '@/i18n-config'
import Loading from './base/loading'
import { usePrefetchQuery } from '@tanstack/react-query'
import { getSystemFeatures } from '@/service/common'

+ 2
- 2
web/app/components/plugins/card/index.tsx Переглянути файл

@@ -9,9 +9,9 @@ import Description from './base/description'
import Placeholder from './base/placeholder'
import cn from '@/utils/classnames'
import { useGetLanguage } from '@/context/i18n'
import { getLanguage } from '@/i18n/language'
import { getLanguage } from '@/i18n-config/language'
import { useSingleCategories } from '../hooks'
import { renderI18nObject } from '@/i18n'
import { renderI18nObject } from '@/i18n-config'
import { useMixedTranslation } from '@/app/components/plugins/marketplace/hooks'
import Partner from '../base/badges/partner'
import Verified from '../base/badges/verified'

+ 1
- 1
web/app/components/plugins/marketplace/description/index.tsx Переглянути файл

@@ -1,7 +1,7 @@
import {
getLocaleOnServer,
useTranslation as translate,
} from '@/i18n/server'
} from '@/i18n-config/server'

type DescriptionProps = {
locale?: string

+ 4
- 4
web/app/components/plugins/marketplace/hooks.ts Переглянути файл

@@ -17,7 +17,7 @@ import {
getFormattedPlugin,
getMarketplaceCollectionsAndPlugins,
} from './utils'
import i18n from '@/i18n/i18next-config'
import i18n from '@/i18n-config/i18next-config'
import {
useMutationPluginsFromMarketplace,
} from '@/service/use-plugins'
@@ -109,6 +109,7 @@ export const useMarketplacePlugins = () => {
export const useMixedTranslation = (localeFromOuter?: string) => {
let t = useTranslation().t

// !localeFromOuter only support zh-Hans and en-US for now
if (localeFromOuter)
t = i18n.getFixedT(localeFromOuter)

@@ -121,8 +122,6 @@ export const useMarketplaceContainerScroll = (
callback: () => void,
scrollContainerId = 'marketplace-container',
) => {
const container = document.getElementById(scrollContainerId)

const handleScroll = useCallback((e: Event) => {
const target = e.target as HTMLDivElement
const {
@@ -135,6 +134,7 @@ export const useMarketplaceContainerScroll = (
}, [callback])

useEffect(() => {
const container = document.getElementById(scrollContainerId)
if (container)
container.addEventListener('scroll', handleScroll)

@@ -142,7 +142,7 @@ export const useMarketplaceContainerScroll = (
if (container)
container.removeEventListener('scroll', handleScroll)
}
}, [container, handleScroll])
}, [handleScroll])
}

export const useSearchBoxAutoAnimate = (searchBoxAutoAnimate?: boolean) => {

+ 1
- 1
web/app/components/plugins/marketplace/intersection-line/hooks.ts Переглянути файл

@@ -2,7 +2,7 @@ import { useEffect } from 'react'
import { useMarketplaceContext } from '@/app/components/plugins/marketplace/context'

export const useScrollIntersection = (
anchorRef: React.RefObject<HTMLDivElement>,
anchorRef: React.RefObject<HTMLDivElement | null>,
intersectionContainerId = 'marketplace-container',
) => {
const intersected = useMarketplaceContext(v => v.intersected)

+ 1
- 1
web/app/components/plugins/marketplace/list/list-with-collection.tsx Переглянути файл

@@ -4,7 +4,7 @@ import { RiArrowRightSLine } from '@remixicon/react'
import type { MarketplaceCollection } from '../types'
import CardWrapper from './card-wrapper'
import type { Plugin } from '@/app/components/plugins/types'
import { getLanguage } from '@/i18n/language'
import { getLanguage } from '@/i18n-config/language'
import cn from '@/utils/classnames'
import type { SearchParamsFromCollection } from '@/app/components/plugins/marketplace/types'
import { useMixedTranslation } from '@/app/components/plugins/marketplace/hooks'

+ 3
- 1
web/app/components/plugins/marketplace/search-box/index.tsx Переглянути файл

@@ -8,6 +8,7 @@ import { RiAddLine } from '@remixicon/react'
type SearchBoxProps = {
search: string
onSearchChange: (search: string) => void
wrapperClassName?: string
inputClassName?: string
tags: string[]
onTagsChange: (tags: string[]) => void
@@ -21,6 +22,7 @@ type SearchBoxProps = {
const SearchBox = ({
search,
onSearchChange,
wrapperClassName,
inputClassName,
tags,
onTagsChange,
@@ -32,7 +34,7 @@ const SearchBox = ({
}: SearchBoxProps) => {
return (
<div
className='z-[11] flex items-center'
className={cn('z-[11] flex items-center', wrapperClassName)}
>
<div className={
cn('flex items-center',

+ 2
- 1
web/app/components/plugins/marketplace/search-box/search-box-wrapper.tsx Переглянути файл

@@ -26,11 +26,12 @@ const SearchBoxWrapper = ({

return (
<SearchBox
inputClassName={cn(
wrapperClassName={cn(
'z-[0] mx-auto w-[640px] shrink-0',
searchBoxCanAnimate && 'sticky top-3 z-[11]',
!intersected && searchBoxCanAnimate && 'w-[508px] transition-[width] duration-300',
)}
inputClassName='w-full'
search={searchPluginText}
onSearchChange={handleSearchPluginTextChange}
tags={filterPluginTags}

+ 1
- 1
web/app/components/plugins/plugin-detail-panel/model-selector/tts-params-panel.tsx Переглянути файл

@@ -1,6 +1,6 @@
import React, { useMemo } from 'react'
import { useTranslation } from 'react-i18next'
import { languages } from '@/i18n/language'
import { languages } from '@/i18n-config/language'
import { PortalSelect } from '@/app/components/base/select'
import cn from '@/utils/classnames'


+ 1
- 1
web/app/components/plugins/plugin-detail-panel/strategy-detail.tsx Переглянути файл

@@ -14,7 +14,7 @@ import Divider from '@/app/components/base/divider'
import type {
StrategyDetail as StrategyDetailType,
} from '@/app/components/plugins/types'
import type { Locale } from '@/i18n'
import type { Locale } from '@/i18n-config'
import { useRenderI18nObject } from '@/hooks/use-i18n'
import { API_PREFIX } from '@/config'
import cn from '@/utils/classnames'

+ 1
- 1
web/app/components/plugins/plugin-detail-panel/strategy-item.tsx Переглянути файл

@@ -4,7 +4,7 @@ import StrategyDetailPanel from './strategy-detail'
import type {
StrategyDetail,
} from '@/app/components/plugins/types'
import type { Locale } from '@/i18n'
import type { Locale } from '@/i18n-config'
import { useRenderI18nObject } from '@/hooks/use-i18n'
import cn from '@/utils/classnames'


+ 1
- 1
web/app/components/plugins/reference-setting-modal/auto-update-setting/tool-item.tsx Переглянути файл

@@ -3,7 +3,7 @@ import type { FC } from 'react'
import React from 'react'
import type { PluginDetail } from '@/app/components/plugins/types'
import Icon from '@/app/components/plugins/card/base/card-icon'
import { renderI18nObject } from '@/i18n'
import { renderI18nObject } from '@/i18n-config'
import { useGetLanguage } from '@/context/i18n'
import { MARKETPLACE_API_PREFIX } from '@/config'
import Checkbox from '@/app/components/base/checkbox'

+ 1
- 1
web/app/components/plugins/types.ts Переглянути файл

@@ -1,6 +1,6 @@
import type { CredentialFormSchemaBase } from '../header/account-setting/model-provider-page/declarations'
import type { ToolCredential } from '@/app/components/tools/types'
import type { Locale } from '@/i18n'
import type { Locale } from '@/i18n-config'
import type { AgentFeature } from '@/app/components/workflow/nodes/agent/types'
import type { AutoUpdateConfig } from './reference-setting-modal/auto-update-setting/types'
export enum PluginType {

+ 1
- 1
web/app/components/plugins/utils.ts Переглянути файл

@@ -1,4 +1,4 @@
import { LanguagesSupported } from '@/i18n/language'
import { LanguagesSupported } from '@/i18n-config/language'

import {
categoryKeys,

+ 1
- 1
web/app/components/share/text-generation/index.tsx Переглянути файл

@@ -24,7 +24,7 @@ import type {
} from '@/models/debug'
import AppIcon from '@/app/components/base/app-icon'
import Badge from '@/app/components/base/badge'
import { changeLanguage } from '@/i18n/i18next-config'
import { changeLanguage } from '@/i18n-config/i18next-config'
import Loading from '@/app/components/base/loading'
import { userInputsFormToPromptVariables } from '@/utils/model-config'
import Res from '@/app/components/share/text-generation/result'

+ 1
- 1
web/app/components/tools/add-tool-modal/category.tsx Переглянути файл

@@ -6,7 +6,7 @@ import { useMount } from 'ahooks'
import cn from '@/utils/classnames'
import { Apps02 } from '@/app/components/base/icons/src/vender/line/others'
import I18n from '@/context/i18n'
import { getLanguage } from '@/i18n/language'
import { getLanguage } from '@/i18n-config/language'
import { useStore as useLabelStore } from '@/app/components/tools/labels/store'
import { fetchLabelList } from '@/service/tools'


+ 1
- 1
web/app/components/tools/edit-custom-collection-modal/test-api.tsx Переглянути файл

@@ -11,7 +11,7 @@ import Input from '@/app/components/base/input'
import Drawer from '@/app/components/base/drawer-plus'
import I18n from '@/context/i18n'
import { testAPIAvailable } from '@/service/tools'
import { getLanguage } from '@/i18n/language'
import { getLanguage } from '@/i18n-config/language'

type Props = {
positionCenter?: boolean

+ 1
- 1
web/app/components/tools/marketplace/index.tsx Переглянути файл

@@ -7,7 +7,7 @@ import { useTranslation } from 'react-i18next'
import type { useMarketplace } from './hooks'
import List from '@/app/components/plugins/marketplace/list'
import Loading from '@/app/components/base/loading'
import { getLocaleOnClient } from '@/i18n'
import { getLocaleOnClient } from '@/i18n-config'
import { getMarketplaceUrl } from '@/utils/var'

type MarketplaceProps = {

+ 1
- 1
web/app/components/tools/mcp/create-card.tsx Переглянути файл

@@ -9,7 +9,7 @@ import {
} from '@remixicon/react'
import MCPModal from './modal'
import I18n from '@/context/i18n'
import { getLanguage } from '@/i18n/language'
import { getLanguage } from '@/i18n-config/language'
import { useAppContext } from '@/context/app-context'
import { useCreateMCP } from '@/service/use-tools'
import type { ToolWithProvider } from '@/app/components/workflow/types'

+ 1
- 1
web/app/components/tools/mcp/detail/tool-item.tsx Переглянути файл

@@ -3,7 +3,7 @@ import React from 'react'
import { useContext } from 'use-context-selector'
import type { Tool } from '@/app/components/tools/types'
import I18n from '@/context/i18n'
import { getLanguage } from '@/i18n/language'
import { getLanguage } from '@/i18n-config/language'
import Tooltip from '@/app/components/base/tooltip'
import cn from '@/utils/classnames'


+ 1
- 1
web/app/components/tools/provider/custom-create-card.tsx Переглянути файл

@@ -9,7 +9,7 @@ import {
} from '@remixicon/react'
import type { CustomCollectionBackend } from '../types'
import I18n from '@/context/i18n'
import { getLanguage } from '@/i18n/language'
import { getLanguage } from '@/i18n-config/language'
import EditCustomToolModal from '@/app/components/tools/edit-custom-collection-modal'
import { createCustomCollection } from '@/service/tools'
import Toast from '@/app/components/base/toast'

+ 1
- 1
web/app/components/tools/provider/detail.tsx Переглянути файл

@@ -11,7 +11,7 @@ import type { Collection, CustomCollectionBackend, Tool, WorkflowToolProviderReq
import ToolItem from './tool-item'
import cn from '@/utils/classnames'
import I18n from '@/context/i18n'
import { getLanguage } from '@/i18n/language'
import { getLanguage } from '@/i18n-config/language'
import Confirm from '@/app/components/base/confirm'
import Button from '@/app/components/base/button'
import Indicator from '@/app/components/header/indicator'

+ 1
- 1
web/app/components/tools/provider/tool-item.tsx Переглянути файл

@@ -4,7 +4,7 @@ import { useContext } from 'use-context-selector'
import type { Collection, Tool } from '../types'
import cn from '@/utils/classnames'
import I18n from '@/context/i18n'
import { getLanguage } from '@/i18n/language'
import { getLanguage } from '@/i18n-config/language'
import SettingBuiltInTool from '@/app/components/app/configuration/config/agent/agent-tools/setting-built-in-tool'

type Props = {

+ 1
- 1
web/app/components/workflow/nodes/agent/default.ts Переглянути файл

@@ -3,7 +3,7 @@ import { ALL_CHAT_AVAILABLE_BLOCKS, ALL_COMPLETION_AVAILABLE_BLOCKS } from '@/ap
import type { NodeDefault } from '../../types'
import type { AgentNodeType } from './types'
import { FormTypeEnum } from '@/app/components/header/account-setting/model-provider-page/declarations'
import { renderI18nObject } from '@/i18n'
import { renderI18nObject } from '@/i18n-config'

const nodeDefault: NodeDefault<AgentNodeType> = {
defaultValue: {

+ 1
- 1
web/app/components/workflow/nodes/document-extractor/panel.tsx Переглянути файл

@@ -13,7 +13,7 @@ import { fetchSupportFileTypes } from '@/service/datasets'
import Field from '@/app/components/workflow/nodes/_base/components/field'
import { BlockEnum, type NodePanelProps } from '@/app/components/workflow/types'
import I18n from '@/context/i18n'
import { LanguagesSupported } from '@/i18n/language'
import { LanguagesSupported } from '@/i18n-config/language'

const i18nPrefix = 'workflow.nodes.docExtractor'


+ 2
- 2
web/app/dev-only/i18n-checker/page.tsx Переглянути файл

@@ -1,8 +1,8 @@
'use client'
import { loadLangResources } from '@/i18n/i18next-config'
import { loadLangResources } from '@/i18n-config/i18next-config'
import { useCallback, useEffect, useState } from 'react'
import cn from '@/utils/classnames'
import { LanguagesSupported } from '@/i18n/language'
import { LanguagesSupported } from '@/i18n-config/language'

export default function I18nTest() {
const [langs, setLangs] = useState<Lang[]>([])

+ 1
- 1
web/app/layout.tsx Переглянути файл

@@ -3,7 +3,7 @@ import type { Viewport } from 'next'
import I18nServer from './components/i18n-server'
import BrowserInitializer from './components/browser-initializer'
import SentryInitializer from './components/sentry-initializer'
import { getLocaleOnServer } from '@/i18n/server'
import { getLocaleOnServer } from '@/i18n-config/server'
import { TanstackQueryInitializer } from '@/context/query-client'
import { ThemeProvider } from 'next-themes'
import './styles/globals.css'

+ 2
- 2
web/app/signin/_header.tsx Переглянути файл

@@ -3,8 +3,8 @@ import React from 'react'
import { useContext } from 'use-context-selector'
import Select from '@/app/components/base/select/locale'
import Divider from '@/app/components/base/divider'
import { languages } from '@/i18n/language'
import type { Locale } from '@/i18n'
import { languages } from '@/i18n-config/language'
import type { Locale } from '@/i18n-config'
import I18n from '@/context/i18n'
import dynamic from 'next/dynamic'
import { useGlobalPublicStore } from '@/context/global-public-context'

+ 1
- 1
web/app/signin/invite-settings/page.tsx Переглянути файл

@@ -11,7 +11,7 @@ import Input from '@/app/components/base/input'
import { SimpleSelect } from '@/app/components/base/select'
import Button from '@/app/components/base/button'
import { timezones } from '@/utils/timezone'
import { LanguagesSupported, languages } from '@/i18n/language'
import { LanguagesSupported, languages } from '@/i18n-config/language'
import I18n from '@/context/i18n'
import { activateMember, invitationCheck } from '@/service/common'
import Loading from '@/app/components/base/loading'

+ 1
- 1
web/app/signin/oneMoreStep.tsx Переглянути файл

@@ -9,7 +9,7 @@ import Button from '@/app/components/base/button'
import Tooltip from '@/app/components/base/tooltip'
import { SimpleSelect } from '@/app/components/base/select'
import { timezones } from '@/utils/timezone'
import { LanguagesSupported, languages } from '@/i18n/language'
import { LanguagesSupported, languages } from '@/i18n-config/language'
import { oneMoreStep } from '@/service/common'
import Toast from '@/app/components/base/toast'
import { useDocLink } from '@/context/i18n'

+ 2
- 2
web/context/i18n.ts Переглянути файл

@@ -2,8 +2,8 @@ import {
createContext,
useContext,
} from 'use-context-selector'
import type { Locale } from '@/i18n'
import { getDocLanguage, getLanguage, getPricingPageLanguage } from '@/i18n/language'
import type { Locale } from '@/i18n-config'
import { getDocLanguage, getLanguage, getPricingPageLanguage } from '@/i18n-config/language'
import { noop } from 'lodash-es'

type II18NContext = {

+ 1
- 1
web/hooks/use-i18n.ts Переглянути файл

@@ -1,5 +1,5 @@
import { useLanguage } from '@/app/components/header/account-setting/model-provider-page/hooks'
import { renderI18nObject } from '@/i18n'
import { renderI18nObject } from '@/i18n-config'

export const useRenderI18nObject = () => {
const language = useLanguage()

web/i18n/DEV.md → web/i18n-config/DEV.md Переглянути файл


web/i18n/README.md → web/i18n-config/README.md Переглянути файл


web/i18n/auto-gen-i18n.js → web/i18n-config/auto-gen-i18n.js Переглянути файл

@@ -1,4 +1,3 @@
/* eslint-disable no-eval */
const fs = require('node:fs')
const path = require('node:path')
const transpile = require('typescript').transpile

web/i18n/check-i18n.js → web/i18n-config/check-i18n.js Переглянути файл

@@ -1,4 +1,3 @@
/* eslint-disable no-eval */
const fs = require('node:fs')
const path = require('node:path')
const transpile = require('typescript').transpile

web/i18n/i18next-config.ts → web/i18n-config/i18next-config.ts Переглянути файл

@@ -6,10 +6,10 @@ import { initReactI18next } from 'react-i18next'
const requireSilent = async (lang: string, namespace: string) => {
let res
try {
res = (await import(`./${lang}/${namespace}`)).default
res = (await import(`../i18n/${lang}/${namespace}`)).default
}
catch {
res = (await import(`./en-US/${namespace}`)).default
res = (await import(`../i18n/en-US/${namespace}`)).default
}

return res
@@ -53,13 +53,27 @@ export const loadLangResources = async (lang: string) => {
return resources
}

const getFallbackTranslation = () => {
const resources = NAMESPACES.reduce((acc, ns, index) => {
acc[camelCase(NAMESPACES[index])] = require(`./en-US/${ns}`).default
/**
* !Need to load en-US and zh-Hans resources for initial rendering, which are used in both marketplace and dify
* !Other languages will be loaded on demand
* !This is to avoid loading all languages at once which can be slow
*/
const getInitialTranslations = () => {
const en_USResources = NAMESPACES.reduce((acc, ns, index) => {
acc[camelCase(NAMESPACES[index])] = require(`../i18n/en-US/${ns}`).default
return acc
}, {} as Record<string, any>)
const zh_HansResources = NAMESPACES.reduce((acc, ns, index) => {
acc[camelCase(NAMESPACES[index])] = require(`../i18n/zh-Hans/${ns}`).default
return acc
}, {} as Record<string, any>)
return {
translation: resources,
'en-US': {
translation: en_USResources,
},
'zh-Hans': {
translation: zh_HansResources,
},
}
}

@@ -68,9 +82,7 @@ if (!i18n.isInitialized) {
.init({
lng: undefined,
fallbackLng: 'en-US',
resources: {
'en-US': getFallbackTranslation(),
},
resources: getInitialTranslations(),
})
}


web/i18n/index.ts → web/i18n-config/index.ts Переглянути файл

@@ -1,8 +1,8 @@
import Cookies from 'js-cookie'

import { changeLanguage } from '@/i18n/i18next-config'
import { changeLanguage } from '@/i18n-config/i18next-config'
import { LOCALE_COOKIE_NAME } from '@/config'
import { LanguagesSupported } from '@/i18n/language'
import { LanguagesSupported } from '@/i18n-config/language'

export const i18n = {
defaultLocale: 'en-US',

web/i18n/language.ts → web/i18n-config/language.ts Переглянути файл


web/i18n/languages.json → web/i18n-config/languages.json Переглянути файл


web/i18n/server.ts → web/i18n-config/server.ts Переглянути файл

@@ -13,7 +13,7 @@ const initI18next = async (lng: Locale, ns: string) => {
const i18nInstance = createInstance()
await i18nInstance
.use(initReactI18next)
.use(resourcesToBackend((language: string, namespace: string) => import(`./${language}/${namespace}.ts`)))
.use(resourcesToBackend((language: string, namespace: string) => import(`../i18n/${language}/${namespace}.ts`)))
.init({
lng: lng === 'zh-Hans' ? 'zh-Hans' : lng,
ns,

+ 1
- 1
web/models/common.ts Переглянути файл

@@ -1,4 +1,4 @@
import type { I18nText } from '@/i18n/language'
import type { I18nText } from '@/i18n-config/language'
import type { Model } from '@/types/app'

export type CommonResponse = {

+ 1
- 1
web/models/share.ts Переглянути файл

@@ -1,4 +1,4 @@
import type { Locale } from '@/i18n'
import type { Locale } from '@/i18n-config'
import type { AppIconType } from '@/types/app'

export type ResponseHolder = {}

+ 1
- 1
web/types/app.ts Переглянути файл

@@ -1,6 +1,6 @@
import type { AnnotationReplyConfig, ChatPromptConfig, CompletionPromptConfig, DatasetConfigs, PromptMode } from '@/models/debug'
import type { CollectionType } from '@/app/components/tools/types'
import type { LanguagesSupported } from '@/i18n/language'
import type { LanguagesSupported } from '@/i18n-config/language'
import type { Tag } from '@/app/components/base/tag-management/constant'
import type {
RerankingModeEnum,

Завантаження…
Відмінити
Зберегти