INNER CODE UNIT · TypeScript

staticParamsFor

i18next/next-i18next · src/appRouter/server.ts:340

function staticParamsFor<K extends string>({ supportedLngs, localeParamName }: NormalizedConfig): Record<K, string>[] {
  return supportedLngs.map(lng => ({ [localeParamName]: lng }) as Record<K, string>)
}

export interface ServerI18next {
  getT: typeof getT
  getResources: typeof getResources
  generateI18nStaticParams: typeof generateI18nStaticParams
}

/**
 * Bind the server API to a config, without `initServerI18next` and without depending on
 * module evaluation order: every caller imports the module that holds the config.
 * Call it once at module scope — each call owns its own shared i18next instance.
 *
 * @example
 * ```ts
 * // i18n.server.ts

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…