Next.js translations
Next.js-översättningar
Next.js App Router changes where translation code can run. Keykit keeps server-side and client-side usage on one source-driven translation catalog.
Keep locale routing and translation management as separate concerns
A common App Router setup places the locale in the URL and lets the route determine which translations should be used.
Keykit manages the translation content and key lifecycle. Your Next.js routing strategy still decides which locale is active for a request.
Server Components
Translate server-rendered content without turning it into a Client Component
Static page copy, headings and other server-rendered strings should be translatable directly from the server.
The translated content is rendered on the server and does not require converting the page into an interactive client component.
import { useKeykit } from '@keykithq/sdk/react';
export default function ProjectsPage() {
const { translate } = useKeykit();
return (
<main>
<h1>{translate('projects.title', 'Projects')}</h1>
<p>{translate('projects.description', 'Your translation projects.')}</p>
</main>
);
}Client Components
Use a hook where React needs client-side behavior
Interactive components can use useKeykit while referencing the same translation catalog.
'use client';
import { useKeykit } from '@keykithq/sdk/react';
export function CreateProjectButton() {
const { translate } = useKeykit();
return <Button>{translate('projects.actions.create', 'Create')}</Button>;
}Choose live or static translation delivery
Next.js teams may want runtime freshness or build-time stability. Set delivery: "live" or delivery: "static".
Live
Resolve translation data through Keykit so copy can update without maintaining generated translation resources manually.
Static
Pull translation data with npx @keykithq/cli pull and keep it versioned as part of the application build.
Next.js translation FAQ
Can I translate directly inside a Next.js Server Component?
Yes. The same useKeykit translate call works from the Keykit provider around the app. A page does not need to become a Client Component only to render translated static copy.
When should I use the client translation hook?
Use useKeykit inside interactive Client Components or when translations need to respond to client-side state.
Can I translate generateMetadata()?
Yes. Metadata runs on the server and can read the same Keykit catalog for the locale of the route.
Do translation updates require a Next.js redeploy?
That depends on the delivery mode. Static translations are pulled into the application with the CLI. Live delivery resolves translation data independently from static application resources.
Use one translation model across your Next.js application
Keep Server Components, Client Components and metadata connected to the same source-driven translation lifecycle.
Start with Next.js