UNPKG

fumadocs-core

Version:

The React.js library for building a documentation website

32 lines • 1.04 kB
import { n as I18nConfig } from "../index-DFrWGSeW.js"; import { NextProxy } from "next/server"; import { NextURL } from "next/dist/server/web/next-url"; interface MiddlewareOptions extends I18nConfig { /** * Either: * - A formatter object * - A function that adds the locale prefix to pathname */ format?: URLFormatter | ((locale: string, pathname: string) => string); /** * the cookie to store locale code when `hideLocale` is set to `always`. */ cookieName?: string; } export interface URLFormatter { /** * get locale code from request URL */ get: (url: NextURL) => string | undefined; /** * add locale code to request URL (which is missing the locale). */ add: (url: NextURL, locale: string) => URL; /** * remove locale code from request URL */ remove: (url: NextURL) => URL; } export declare const DefaultFormatter: URLFormatter; export declare function createI18nMiddleware({ languages, defaultLanguage, format, cookieName, hideLocale }: MiddlewareOptions): NextProxy; export {};