INNER CODE UNIT · TypeScript
getTWith
i18next/next-i18next · src/appRouter/server.ts:239
async function getTWith<
Ns extends FlatNamespace = FlatNamespace,
KPrefix extends KeyPrefix<Ns> = undefined,
>(
state: ServerState,
ns?: Ns | Ns[],
options: GetTOptions<KPrefix> = {},
): Promise<GetTResult<Ns, KPrefix>> {
const { config } = state
const lng = options.lng || await detectLanguage(config)
const i18nInstance = await getSharedInstance(state)
if (config.reloadOnPrerender && process.env.NODE_ENV !== 'production') {
await reloadResourcesForRender(i18nInstance, lng)
}
// Load the requested language on demand. No-op when it is already preloaded