INNER CODE UNIT · TypeScript

generateI18nStaticParams

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

export function generateI18nStaticParams<K extends string = 'lng'>(): Record<K, string>[] {
  return staticParamsFor<K>(getState().config)
}

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.

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…