Selaa lähdekoodia

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

tags/1.7.1
Wu Tianwei 3 kuukautta sitten
vanhempi
commit
ad472d59e0
No account linked to committer's email address
70 muutettua tiedostoa jossa 96 lisäystä ja 85 poistoa
  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 Näytä tiedosto

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


export type IDevelopProps = { export type IDevelopProps = {

+ 1
- 1
web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/settings/page.tsx Näytä tiedosto

import React from 'react' 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' import Form from '@/app/components/datasets/settings/form'


const Settings = async () => { const Settings = async () => {

+ 1
- 1
web/app/(commonLayout)/datasets/Doc.tsx Näytä tiedosto

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

+ 1
- 1
web/app/(commonLayout)/plugins/page.tsx Näytä tiedosto

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


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

+ 1
- 1
web/app/components/app/annotation/batch-add-annotation-modal/csv-downloader.tsx Näytä tiedosto

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


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

+ 1
- 1
web/app/components/app/annotation/header-opts/index.tsx Näytä tiedosto



import I18n from '@/context/i18n' import I18n from '@/context/i18n'
import { fetchExportAnnotationList } from '@/service/annotation' 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_EN = ['Question', 'Answer']
const CSV_HEADER_QA_CN = ['问题', '答案'] const CSV_HEADER_QA_CN = ['问题', '答案']

+ 1
- 1
web/app/components/app/configuration/config/agent/agent-tools/setting-built-in-tool.tsx Näytä tiedosto

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

+ 1
- 1
web/app/components/app/configuration/tools/external-data-tool-modal.tsx Näytä tiedosto

import { fetchCodeBasedExtensionList } from '@/service/common' import { fetchCodeBasedExtensionList } from '@/service/common'
import { SimpleSelect } from '@/app/components/base/select' import { SimpleSelect } from '@/app/components/base/select'
import I18n from '@/context/i18n' import I18n from '@/context/i18n'
import { LanguagesSupported } from '@/i18n/language'
import { LanguagesSupported } from '@/i18n-config/language'
import type { import type {
CodeBasedExtensionItem, CodeBasedExtensionItem,
ExternalDataTool, ExternalDataTool,

+ 1
- 1
web/app/components/app/overview/settings/index.tsx Näytä tiedosto

import type { AppDetailResponse } from '@/models/app' import type { AppDetailResponse } from '@/models/app'
import type { AppIconType, AppSSO, Language } from '@/types/app' import type { AppIconType, AppSSO, Language } from '@/types/app'
import { useToastContext } from '@/app/components/base/toast' 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 Tooltip from '@/app/components/base/tooltip'
import { useProviderContext } from '@/context/provider-context' import { useProviderContext } from '@/context/provider-context'
import { useModalContext } from '@/context/modal-context' import { useModalContext } from '@/context/modal-context'

+ 1
- 1
web/app/components/base/chat/chat-with-history/hooks.tsx Näytä tiedosto

ConversationItem, ConversationItem,
} from '@/models/share' } from '@/models/share'
import { useToastContext } from '@/app/components/base/toast' 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 { useAppFavicon } from '@/hooks/use-app-favicon'
import { InputVarType } from '@/app/components/workflow/types' import { InputVarType } from '@/app/components/workflow/types'
import { TransferMethod } from '@/types/app' import { TransferMethod } from '@/types/app'

+ 1
- 1
web/app/components/base/chat/embedded-chatbot/hooks.tsx Näytä tiedosto

ConversationItem, ConversationItem,
} from '@/models/share' } from '@/models/share'
import { useToastContext } from '@/app/components/base/toast' 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 { InputVarType } from '@/app/components/workflow/types'
import { TransferMethod } from '@/types/app' import { TransferMethod } from '@/types/app'
import { addFileInfos, sortAgentSorts } from '@/app/components/tools/utils' import { addFileInfos, sortAgentSorts } from '@/app/components/tools/utils'

+ 1
- 1
web/app/components/base/features/new-feature-panel/moderation/moderation-setting-modal.tsx Näytä tiedosto

} from '@/service/common' } from '@/service/common'
import type { CodeBasedExtensionItem } from '@/models/common' import type { CodeBasedExtensionItem } from '@/models/common'
import I18n from '@/context/i18n' 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 { InfoCircle } from '@/app/components/base/icons/src/vender/line/general'
import { useModalContext } from '@/context/modal-context' import { useModalContext } from '@/context/modal-context'
import { CustomConfigurationStatusEnum } from '@/app/components/header/account-setting/model-provider-page/declarations' 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 Näytä tiedosto

import { useFeatures, useFeaturesStore } from '@/app/components/base/features/hooks' import { useFeatures, useFeaturesStore } from '@/app/components/base/features/hooks'
import type { OnFeaturesChange } from '@/app/components/base/features/types' import type { OnFeaturesChange } from '@/app/components/base/features/types'
import { FeatureEnum } 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' import { TtsAutoPlay } from '@/types/app'


type Props = { type Props = {

+ 1
- 1
web/app/components/base/features/new-feature-panel/text-to-speech/param-config-content.tsx Näytä tiedosto

import Tooltip from '@/app/components/base/tooltip' import Tooltip from '@/app/components/base/tooltip'
import Switch from '@/app/components/base/switch' import Switch from '@/app/components/base/switch'
import AudioBtn from '@/app/components/base/audio-btn' 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 { TtsAutoPlay } from '@/types/app'
import type { OnFeaturesChange } from '@/app/components/base/features/types' import type { OnFeaturesChange } from '@/app/components/base/features/types'
import classNames from '@/utils/classnames' import classNames from '@/utils/classnames'

+ 1
- 1
web/app/components/datasets/create/file-uploader/index.tsx Näytä tiedosto

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

+ 1
- 3
web/app/components/datasets/create/step-two/index.tsx Näytä tiedosto

import { RETRIEVE_METHOD } from '@/types/app' import { RETRIEVE_METHOD } from '@/types/app'
import useBreakpoints, { MediaType } from '@/hooks/use-breakpoints' import useBreakpoints, { MediaType } from '@/hooks/use-breakpoints'
import { useDefaultModel, useModelList, useModelListAndDefaultModelAndCurrentProviderAndModel } from '@/app/components/header/account-setting/model-provider-page/hooks' 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 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 type { DefaultModel } from '@/app/components/header/account-setting/model-provider-page/declarations'
import { ModelTypeEnum } from '@/app/components/header/account-setting/model-provider-page/declarations' import { ModelTypeEnum } from '@/app/components/header/account-setting/model-provider-page/declarations'
score_threshold_enabled: false, score_threshold_enabled: false,
score_threshold: 0.5, score_threshold: 0.5,
}) })
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [rerankDefaultModel, isRerankDefaultModelValid]) }, [rerankDefaultModel, isRerankDefaultModelValid])


const getCreationParams = () => { const getCreationParams = () => {
getRulesFromDetail() getRulesFromDetail()
getDefaultMode() getDefaultMode()
} }
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []) }, [])


useEffect(() => { useEffect(() => {

+ 1
- 1
web/app/components/datasets/create/step-two/language-select/index.tsx Näytä tiedosto

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


export type ILanguageSelectProps = { export type ILanguageSelectProps = {
currentLanguage: string currentLanguage: string

+ 1
- 1
web/app/components/datasets/documents/detail/batch-modal/csv-downloader.tsx Näytä tiedosto

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


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

+ 1
- 1
web/app/components/develop/doc.tsx Näytä tiedosto

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

+ 1
- 1
web/app/components/header/account-setting/language-page/index.tsx Näytä tiedosto

import { ToastContext } from '@/app/components/base/toast' import { ToastContext } from '@/app/components/base/toast'
import I18n from '@/context/i18n' import I18n from '@/context/i18n'
import { timezones } from '@/utils/timezone' import { timezones } from '@/utils/timezone'
import { languages } from '@/i18n/language'
import { languages } from '@/i18n-config/language'


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

+ 1
- 1
web/app/components/header/account-setting/members-page/index.tsx Näytä tiedosto

import Button from '@/app/components/base/button' import Button from '@/app/components/base/button'
import UpgradeBtn from '@/app/components/billing/upgrade-btn' import UpgradeBtn from '@/app/components/billing/upgrade-btn'
import { NUM_INFINITE } from '@/app/components/billing/config' 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 cn from '@/utils/classnames'
import Tooltip from '@/app/components/base/tooltip' import Tooltip from '@/app/components/base/tooltip'
import { RiPencilLine } from '@remixicon/react' import { RiPencilLine } from '@remixicon/react'

+ 1
- 1
web/app/components/header/account-setting/model-provider-page/install-from-marketplace.tsx Näytä tiedosto

import List from '@/app/components/plugins/marketplace/list' import List from '@/app/components/plugins/marketplace/list'
import type { Plugin } from '@/app/components/plugins/types' import type { Plugin } from '@/app/components/plugins/types'
import cn from '@/utils/classnames' import cn from '@/utils/classnames'
import { getLocaleOnClient } from '@/i18n'
import { getLocaleOnClient } from '@/i18n-config'
import { getMarketplaceUrl } from '@/utils/var' import { getMarketplaceUrl } from '@/utils/var'


type InstallFromMarketplaceProps = { type InstallFromMarketplaceProps = {

+ 1
- 1
web/app/components/header/account-setting/model-provider-page/model-icon/index.tsx Näytä tiedosto

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


type ModelIconProps = { type ModelIconProps = {
provider?: Model | ModelProvider provider?: Model | ModelProvider

+ 1
- 1
web/app/components/header/account-setting/model-provider-page/provider-icon/index.tsx Näytä tiedosto

import { useLanguage } from '../hooks' import { useLanguage } from '../hooks'
import { Openai } from '@/app/components/base/icons/src/vender/other' import { Openai } from '@/app/components/base/icons/src/vender/other'
import { AnthropicDark, AnthropicLight } from '@/app/components/base/icons/src/public/llm' 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 { Theme } from '@/types/app'
import cn from '@/utils/classnames' import cn from '@/utils/classnames'
import useTheme from '@/hooks/use-theme' import useTheme from '@/hooks/use-theme'

+ 1
- 1
web/app/components/header/maintenance-notice.tsx Näytä tiedosto

import { useState } from 'react' import { useState } from 'react'
import { X } from '@/app/components/base/icons/src/vender/line/general' 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' import { useLanguage } from '@/app/components/header/account-setting/model-provider-page/hooks'


const MaintenanceNotice = () => { const MaintenanceNotice = () => {

+ 1
- 1
web/app/components/i18n-server.tsx Näytä tiedosto

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


export type II18NServerProps = { export type II18NServerProps = {
children: React.ReactNode children: React.ReactNode

+ 2
- 2
web/app/components/i18n.tsx Näytä tiedosto

import type { FC } from 'react' import type { FC } from 'react'
import React, { useEffect, useState } from 'react' import React, { useEffect, useState } from 'react'
import I18NContext from '@/context/i18n' 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 Loading from './base/loading'
import { usePrefetchQuery } from '@tanstack/react-query' import { usePrefetchQuery } from '@tanstack/react-query'
import { getSystemFeatures } from '@/service/common' import { getSystemFeatures } from '@/service/common'

+ 2
- 2
web/app/components/plugins/card/index.tsx Näytä tiedosto

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

+ 1
- 1
web/app/components/plugins/marketplace/description/index.tsx Näytä tiedosto

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


type DescriptionProps = { type DescriptionProps = {
locale?: string locale?: string

+ 4
- 4
web/app/components/plugins/marketplace/hooks.ts Näytä tiedosto

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


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


callback: () => void, callback: () => void,
scrollContainerId = 'marketplace-container', scrollContainerId = 'marketplace-container',
) => { ) => {
const container = document.getElementById(scrollContainerId)

const handleScroll = useCallback((e: Event) => { const handleScroll = useCallback((e: Event) => {
const target = e.target as HTMLDivElement const target = e.target as HTMLDivElement
const { const {
}, [callback]) }, [callback])


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


if (container) if (container)
container.removeEventListener('scroll', handleScroll) container.removeEventListener('scroll', handleScroll)
} }
}, [container, handleScroll])
}, [handleScroll])
} }


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

+ 1
- 1
web/app/components/plugins/marketplace/intersection-line/hooks.ts Näytä tiedosto

import { useMarketplaceContext } from '@/app/components/plugins/marketplace/context' import { useMarketplaceContext } from '@/app/components/plugins/marketplace/context'


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

+ 1
- 1
web/app/components/plugins/marketplace/list/list-with-collection.tsx Näytä tiedosto

import type { MarketplaceCollection } from '../types' import type { MarketplaceCollection } from '../types'
import CardWrapper from './card-wrapper' import CardWrapper from './card-wrapper'
import type { Plugin } from '@/app/components/plugins/types' 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 cn from '@/utils/classnames'
import type { SearchParamsFromCollection } from '@/app/components/plugins/marketplace/types' import type { SearchParamsFromCollection } from '@/app/components/plugins/marketplace/types'
import { useMixedTranslation } from '@/app/components/plugins/marketplace/hooks' import { useMixedTranslation } from '@/app/components/plugins/marketplace/hooks'

+ 3
- 1
web/app/components/plugins/marketplace/search-box/index.tsx Näytä tiedosto

type SearchBoxProps = { type SearchBoxProps = {
search: string search: string
onSearchChange: (search: string) => void onSearchChange: (search: string) => void
wrapperClassName?: string
inputClassName?: string inputClassName?: string
tags: string[] tags: string[]
onTagsChange: (tags: string[]) => void onTagsChange: (tags: string[]) => void
const SearchBox = ({ const SearchBox = ({
search, search,
onSearchChange, onSearchChange,
wrapperClassName,
inputClassName, inputClassName,
tags, tags,
onTagsChange, onTagsChange,
}: SearchBoxProps) => { }: SearchBoxProps) => {
return ( return (
<div <div
className='z-[11] flex items-center'
className={cn('z-[11] flex items-center', wrapperClassName)}
> >
<div className={ <div className={
cn('flex items-center', cn('flex items-center',

+ 2
- 1
web/app/components/plugins/marketplace/search-box/search-box-wrapper.tsx Näytä tiedosto



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

+ 1
- 1
web/app/components/plugins/plugin-detail-panel/model-selector/tts-params-panel.tsx Näytä tiedosto

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



+ 1
- 1
web/app/components/plugins/plugin-detail-panel/strategy-detail.tsx Näytä tiedosto

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

+ 1
- 1
web/app/components/plugins/plugin-detail-panel/strategy-item.tsx Näytä tiedosto

import type { import type {
StrategyDetail, StrategyDetail,
} from '@/app/components/plugins/types' } from '@/app/components/plugins/types'
import type { Locale } from '@/i18n'
import type { Locale } from '@/i18n-config'
import { useRenderI18nObject } from '@/hooks/use-i18n' import { useRenderI18nObject } from '@/hooks/use-i18n'
import cn from '@/utils/classnames' import cn from '@/utils/classnames'



+ 1
- 1
web/app/components/plugins/reference-setting-modal/auto-update-setting/tool-item.tsx Näytä tiedosto

import React from 'react' import React from 'react'
import type { PluginDetail } from '@/app/components/plugins/types' import type { PluginDetail } from '@/app/components/plugins/types'
import Icon from '@/app/components/plugins/card/base/card-icon' 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 { useGetLanguage } from '@/context/i18n'
import { MARKETPLACE_API_PREFIX } from '@/config' import { MARKETPLACE_API_PREFIX } from '@/config'
import Checkbox from '@/app/components/base/checkbox' import Checkbox from '@/app/components/base/checkbox'

+ 1
- 1
web/app/components/plugins/types.ts Näytä tiedosto

import type { CredentialFormSchemaBase } from '../header/account-setting/model-provider-page/declarations' import type { CredentialFormSchemaBase } from '../header/account-setting/model-provider-page/declarations'
import type { ToolCredential } from '@/app/components/tools/types' 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 { AgentFeature } from '@/app/components/workflow/nodes/agent/types'
import type { AutoUpdateConfig } from './reference-setting-modal/auto-update-setting/types' import type { AutoUpdateConfig } from './reference-setting-modal/auto-update-setting/types'
export enum PluginType { export enum PluginType {

+ 1
- 1
web/app/components/plugins/utils.ts Näytä tiedosto

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


import { import {
categoryKeys, categoryKeys,

+ 1
- 1
web/app/components/share/text-generation/index.tsx Näytä tiedosto

} from '@/models/debug' } from '@/models/debug'
import AppIcon from '@/app/components/base/app-icon' import AppIcon from '@/app/components/base/app-icon'
import Badge from '@/app/components/base/badge' 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 Loading from '@/app/components/base/loading'
import { userInputsFormToPromptVariables } from '@/utils/model-config' import { userInputsFormToPromptVariables } from '@/utils/model-config'
import Res from '@/app/components/share/text-generation/result' import Res from '@/app/components/share/text-generation/result'

+ 1
- 1
web/app/components/tools/add-tool-modal/category.tsx Näytä tiedosto

import cn from '@/utils/classnames' import cn from '@/utils/classnames'
import { Apps02 } from '@/app/components/base/icons/src/vender/line/others' import { Apps02 } from '@/app/components/base/icons/src/vender/line/others'
import I18n from '@/context/i18n' 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 { useStore as useLabelStore } from '@/app/components/tools/labels/store'
import { fetchLabelList } from '@/service/tools' import { fetchLabelList } from '@/service/tools'



+ 1
- 1
web/app/components/tools/edit-custom-collection-modal/test-api.tsx Näytä tiedosto

import Drawer from '@/app/components/base/drawer-plus' import Drawer from '@/app/components/base/drawer-plus'
import I18n from '@/context/i18n' import I18n from '@/context/i18n'
import { testAPIAvailable } from '@/service/tools' import { testAPIAvailable } from '@/service/tools'
import { getLanguage } from '@/i18n/language'
import { getLanguage } from '@/i18n-config/language'


type Props = { type Props = {
positionCenter?: boolean positionCenter?: boolean

+ 1
- 1
web/app/components/tools/marketplace/index.tsx Näytä tiedosto

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


type MarketplaceProps = { type MarketplaceProps = {

+ 1
- 1
web/app/components/tools/mcp/create-card.tsx Näytä tiedosto

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

+ 1
- 1
web/app/components/tools/mcp/detail/tool-item.tsx Näytä tiedosto

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



+ 1
- 1
web/app/components/tools/provider/custom-create-card.tsx Näytä tiedosto

} from '@remixicon/react' } from '@remixicon/react'
import type { CustomCollectionBackend } from '../types' import type { CustomCollectionBackend } from '../types'
import I18n from '@/context/i18n' 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 EditCustomToolModal from '@/app/components/tools/edit-custom-collection-modal'
import { createCustomCollection } from '@/service/tools' import { createCustomCollection } from '@/service/tools'
import Toast from '@/app/components/base/toast' import Toast from '@/app/components/base/toast'

+ 1
- 1
web/app/components/tools/provider/detail.tsx Näytä tiedosto

import ToolItem from './tool-item' import ToolItem from './tool-item'
import cn from '@/utils/classnames' import cn from '@/utils/classnames'
import I18n from '@/context/i18n' import I18n from '@/context/i18n'
import { getLanguage } from '@/i18n/language'
import { getLanguage } from '@/i18n-config/language'
import Confirm from '@/app/components/base/confirm' import Confirm from '@/app/components/base/confirm'
import Button from '@/app/components/base/button' import Button from '@/app/components/base/button'
import Indicator from '@/app/components/header/indicator' import Indicator from '@/app/components/header/indicator'

+ 1
- 1
web/app/components/tools/provider/tool-item.tsx Näytä tiedosto

import type { Collection, Tool } from '../types' import type { Collection, Tool } from '../types'
import cn from '@/utils/classnames' import cn from '@/utils/classnames'
import I18n from '@/context/i18n' 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' import SettingBuiltInTool from '@/app/components/app/configuration/config/agent/agent-tools/setting-built-in-tool'


type Props = { type Props = {

+ 1
- 1
web/app/components/workflow/nodes/agent/default.ts Näytä tiedosto

import type { NodeDefault } from '../../types' import type { NodeDefault } from '../../types'
import type { AgentNodeType } from './types' import type { AgentNodeType } from './types'
import { FormTypeEnum } from '@/app/components/header/account-setting/model-provider-page/declarations' 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> = { const nodeDefault: NodeDefault<AgentNodeType> = {
defaultValue: { defaultValue: {

+ 1
- 1
web/app/components/workflow/nodes/document-extractor/panel.tsx Näytä tiedosto

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


const i18nPrefix = 'workflow.nodes.docExtractor' const i18nPrefix = 'workflow.nodes.docExtractor'



+ 2
- 2
web/app/dev-only/i18n-checker/page.tsx Näytä tiedosto

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


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

+ 1
- 1
web/app/layout.tsx Näytä tiedosto

import I18nServer from './components/i18n-server' import I18nServer from './components/i18n-server'
import BrowserInitializer from './components/browser-initializer' import BrowserInitializer from './components/browser-initializer'
import SentryInitializer from './components/sentry-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 { TanstackQueryInitializer } from '@/context/query-client'
import { ThemeProvider } from 'next-themes' import { ThemeProvider } from 'next-themes'
import './styles/globals.css' import './styles/globals.css'

+ 2
- 2
web/app/signin/_header.tsx Näytä tiedosto

import { useContext } from 'use-context-selector' import { useContext } from 'use-context-selector'
import Select from '@/app/components/base/select/locale' import Select from '@/app/components/base/select/locale'
import Divider from '@/app/components/base/divider' 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 I18n from '@/context/i18n'
import dynamic from 'next/dynamic' import dynamic from 'next/dynamic'
import { useGlobalPublicStore } from '@/context/global-public-context' import { useGlobalPublicStore } from '@/context/global-public-context'

+ 1
- 1
web/app/signin/invite-settings/page.tsx Näytä tiedosto

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

+ 1
- 1
web/app/signin/oneMoreStep.tsx Näytä tiedosto

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

+ 2
- 2
web/context/i18n.ts Näytä tiedosto

createContext, createContext,
useContext, useContext,
} from 'use-context-selector' } 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' import { noop } from 'lodash-es'


type II18NContext = { type II18NContext = {

+ 1
- 1
web/hooks/use-i18n.ts Näytä tiedosto

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


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

web/i18n/DEV.md → web/i18n-config/DEV.md Näytä tiedosto


web/i18n/README.md → web/i18n-config/README.md Näytä tiedosto


web/i18n/auto-gen-i18n.js → web/i18n-config/auto-gen-i18n.js Näytä tiedosto

/* eslint-disable no-eval */
const fs = require('node:fs') const fs = require('node:fs')
const path = require('node:path') const path = require('node:path')
const transpile = require('typescript').transpile const transpile = require('typescript').transpile

web/i18n/check-i18n.js → web/i18n-config/check-i18n.js Näytä tiedosto

/* eslint-disable no-eval */
const fs = require('node:fs') const fs = require('node:fs')
const path = require('node:path') const path = require('node:path')
const transpile = require('typescript').transpile const transpile = require('typescript').transpile

web/i18n/i18next-config.ts → web/i18n-config/i18next-config.ts Näytä tiedosto

const requireSilent = async (lang: string, namespace: string) => { const requireSilent = async (lang: string, namespace: string) => {
let res let res
try { try {
res = (await import(`./${lang}/${namespace}`)).default
res = (await import(`../i18n/${lang}/${namespace}`)).default
} }
catch { catch {
res = (await import(`./en-US/${namespace}`)).default
res = (await import(`../i18n/en-US/${namespace}`)).default
} }


return res return res
return resources 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 return acc
}, {} as Record<string, any>) }, {} as Record<string, any>)
return { return {
translation: resources,
'en-US': {
translation: en_USResources,
},
'zh-Hans': {
translation: zh_HansResources,
},
} }
} }


.init({ .init({
lng: undefined, lng: undefined,
fallbackLng: 'en-US', fallbackLng: 'en-US',
resources: {
'en-US': getFallbackTranslation(),
},
resources: getInitialTranslations(),
}) })
} }



web/i18n/index.ts → web/i18n-config/index.ts Näytä tiedosto

import Cookies from 'js-cookie' 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 { LOCALE_COOKIE_NAME } from '@/config'
import { LanguagesSupported } from '@/i18n/language'
import { LanguagesSupported } from '@/i18n-config/language'


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

web/i18n/language.ts → web/i18n-config/language.ts Näytä tiedosto


web/i18n/languages.json → web/i18n-config/languages.json Näytä tiedosto


web/i18n/server.ts → web/i18n-config/server.ts Näytä tiedosto

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

+ 1
- 1
web/models/common.ts Näytä tiedosto

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


export type CommonResponse = { export type CommonResponse = {

+ 1
- 1
web/models/share.ts Näytä tiedosto

import type { Locale } from '@/i18n'
import type { Locale } from '@/i18n-config'
import type { AppIconType } from '@/types/app' import type { AppIconType } from '@/types/app'


export type ResponseHolder = {} export type ResponseHolder = {}

+ 1
- 1
web/types/app.ts Näytä tiedosto

import type { AnnotationReplyConfig, ChatPromptConfig, CompletionPromptConfig, DatasetConfigs, PromptMode } from '@/models/debug' import type { AnnotationReplyConfig, ChatPromptConfig, CompletionPromptConfig, DatasetConfigs, PromptMode } from '@/models/debug'
import type { CollectionType } from '@/app/components/tools/types' 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 { Tag } from '@/app/components/base/tag-management/constant'
import type { import type {
RerankingModeEnum, RerankingModeEnum,

Loading…
Peruuta
Tallenna