From 50fa0d15125c620af518a524dcde0b944b0583e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AF=97=E6=B5=93?= Date: Sat, 3 May 2025 20:03:56 +0800 Subject: [PATCH] feat: Plugin page related document supports multiple languages (#19197) --- .../components/plugins/plugin-page/debug-info.tsx | 6 +++++- web/app/components/plugins/plugin-page/index.tsx | 4 ++-- web/app/components/plugins/utils.ts | 14 ++++++++++++++ 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/web/app/components/plugins/plugin-page/debug-info.tsx b/web/app/components/plugins/plugin-page/debug-info.tsx index bd59e5d737..28b8a7fc49 100644 --- a/web/app/components/plugins/plugin-page/debug-info.tsx +++ b/web/app/components/plugins/plugin-page/debug-info.tsx @@ -1,6 +1,8 @@ 'use client' import type { FC } from 'react' import React from 'react' +import { useContext } from 'use-context-selector' +import I18n from '@/context/i18n' import { RiArrowRightUpLine, RiBugLine, @@ -9,12 +11,14 @@ import { useTranslation } from 'react-i18next' import KeyValueItem from '../base/key-value-item' import Tooltip from '@/app/components/base/tooltip' import Button from '@/app/components/base/button' +import { getDocsUrl } from '@/app/components/plugins/utils' import { useDebugKey } from '@/service/use-plugins' const i18nPrefix = 'plugin.debugInfo' const DebugInfo: FC = () => { const { t } = useTranslation() + const { locale } = useContext(I18n) const { data: info, isLoading } = useDebugKey() // info.key likes 4580bdb7-b878-471c-a8a4-bfd760263a53 mask the middle part using *. @@ -30,7 +34,7 @@ const DebugInfo: FC = () => { <>
{t(`${i18nPrefix}.title`)} - + {t(`${i18nPrefix}.viewDocs`)} diff --git a/web/app/components/plugins/plugin-page/index.tsx b/web/app/components/plugins/plugin-page/index.tsx index a4bc7a6e6c..cb57b7f4c6 100644 --- a/web/app/components/plugins/plugin-page/index.tsx +++ b/web/app/components/plugins/plugin-page/index.tsx @@ -34,10 +34,10 @@ import { import type { Dependency } from '../types' import type { PluginDeclaration, PluginManifestInMarket } from '../types' import { sleep } from '@/utils' +import { getDocsUrl } from '@/app/components/plugins/utils' import { fetchBundleInfoFromMarketPlace, fetchManifestFromMarketPlace } from '@/service/plugins' import { marketplaceApiPrefix } from '@/config' import { SUPPORT_INSTALL_LOCAL_FILE_EXTENSIONS } from '@/config' -import { LanguagesSupported } from '@/i18n/language' import I18n from '@/context/i18n' import { noop } from 'lodash-es' import { PLUGIN_TYPE_SEARCH_MAP } from '../marketplace/plugin-type-switch' @@ -187,7 +187,7 @@ const PluginPage = ({ isExploringMarketplace && ( <>