wwf
2025-05-20 938c3e5a587ce950a94964ea509b9e7f8834dfae
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { LanguagesSupported } from '@/i18n/language'
 
import {
  categoryKeys,
  tagKeys,
} from './constants'
 
export const getValidTagKeys = (tags: string[]) => {
  return tags.filter(tag => tagKeys.includes(tag))
}
 
export const getValidCategoryKeys = (category?: string) => {
  return categoryKeys.find(key => key === category)
}
 
export const getDocsUrl = (locale: string, path: string) => {
  let localePath = 'en'
 
  if (locale === LanguagesSupported[1])
    localePath = 'zh-hans'
 
  else if (locale === LanguagesSupported[7])
    localePath = 'ja-jp'
 
  return `https://docs.dify.ai/${localePath}${path}`
}