Files
martials.no/src/utils/linking.ts

38 lines
778 B
TypeScript

import type { AbsolutePathname, Project } from "@/types/types.ts"
interface TranslatedPathnames {
nb: AbsolutePathname
en: `/en${AbsolutePathname}`
}
export type NavLink =
| "/"
| "/contact"
| "/projects"
| `/projects/${Project["id"]}`
| "/links"
| "/uses"
const paths: Set<NavLink> = new Set([
"/",
"/contact",
"/projects",
"/links",
"/uses",
])
/**
* Defines the localized pathnames for the site.
* The key must be used to navigate to the correct path.
* The value is the path that will be used for the given locale.
*
* @see https://inlang.com/m/iljlwzfs/paraglide-astro-i18n
*/
const pathnames: Record<AbsolutePathname, TranslatedPathnames> = {}
for (const path of paths) {
pathnames[path] = {
nb: path,
en: `/en${path}`,
}
}