INNER CODE UNIT · TypeScript

getState

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

function getState(): ServerState {
  if (!shared.state) {
    throw new Error(
      'next-i18next: server i18n is not initialized. Call initServerI18next(config) before the first ' +
      'getT() in this process, or use createServerI18next(config) and import getT from its result, ' +
      'which needs no initialization.'
    )
  }
  return shared.state
}

/**
 * Initialize the server-side i18next configuration for the module-level `getT`.
 * Call it once at module scope, before the first `getT()` in the process (the root
 * layout works in practice). Calling it again only replaces the config; the shared
 * i18next instance is kept. Prefer `createServerI18next` when you would rather not
 * depend on module evaluation order.
 */

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…