(item: { text: LText; link: string }, lang: string)
| 45 | } |
| 46 | |
| 47 | export function createLink(item: { text: LText; link: string }, lang: string): string { |
| 48 | if (isExternal(item)) { |
| 49 | return item.link; |
| 50 | } |
| 51 | |
| 52 | if (item.link.startsWith("/")) { |
| 53 | if (isLocalizedLink(item)) { |
| 54 | return item.link; |
| 55 | } |
| 56 | |
| 57 | return `/${lang}${item.link}`; |
| 58 | } |
| 59 | |
| 60 | return item.link; |
| 61 | } |
| 62 | |
| 63 | export function createChangeLangLinks({ slug }: { slug: string }) { |
| 64 | return Object.entries(KNOWN_LANGUAGES).map(([name, code]) => ({ |
no test coverage detected
searching dependent graphs…