add getDocLink method

pull/20801/head
Bowen Liang 12 months ago
parent fc6e2d14a5
commit e28d6d4220

@ -3,6 +3,7 @@ import {
useContext, useContext,
} from 'use-context-selector' } from 'use-context-selector'
import type { Locale } from '@/i18n' import type { Locale } from '@/i18n'
import { getLocaleOnClient } from '@/i18n'
import { getDocLanguage, getLanguage, getPricingPageLanguage } from '@/i18n/language' import { getDocLanguage, getLanguage, getPricingPageLanguage } from '@/i18n/language'
import { noop } from 'lodash-es' import { noop } from 'lodash-es'
@ -35,4 +36,10 @@ export const useGetPricingPageLanguage = () => {
return getPricingPageLanguage(locale) 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 export default I18NContext

Loading…
Cancel
Save