UNPKG

fumadocs-core

Version:

The library for building a documentation website in Next.js

43 lines (39 loc) 1.16 kB
import { NextMiddleware } from 'next/dist/server/web/types'; interface MiddlewareOptions extends I18nConfig { /** * A function that adds the locale prefix to path name */ format?: (locale: string, path: string) => string; } declare function createI18nMiddleware({ languages, defaultLanguage, format, hideLocale, }: MiddlewareOptions): NextMiddleware; interface I18nConfig { /** * Supported locale codes. * * A page tree will be built for each language. */ languages: string[]; /** * Default locale if not specified */ defaultLanguage: string; /** * Don't show the locale prefix on URL. * * - `always`: Always hide the prefix * - `default-locale`: Only hide the default locale * - `never`: Never hide the prefix * * This API uses `NextResponse.rewrite`. * * @defaultValue 'never' */ hideLocale?: 'always' | 'default-locale' | 'never'; /** * Used by `loader()`, specify the way to parse i18n file structure. * * @defaultValue 'dot' */ parser?: 'dot' | 'dir'; } export { type I18nConfig, createI18nMiddleware };