diff --git a/web/context/i18n.ts b/web/context/i18n.ts index 463e01d1c5..04d49d2808 100644 --- a/web/context/i18n.ts +++ b/web/context/i18n.ts @@ -3,6 +3,7 @@ import { useContext, } from 'use-context-selector' import type { Locale } from '@/i18n' +import { getLocaleOnClient } from '@/i18n' import { getDocLanguage, getLanguage, getPricingPageLanguage } from '@/i18n/language' import { noop } from 'lodash-es' @@ -35,4 +36,10 @@ export const useGetPricingPageLanguage = () => { return getPricingPageLanguage(locale) } +const baseDocUrl = 'https://docs.dify.ai' +export const getDocLink = (path: string) => { + const docLanguage = getLocaleOnClient() === 'zh-Hans' ? '/zh-hans' : '/' + return `${baseDocUrl}${docLanguage}/${path}` +} + export default I18NContext