Next.js / Setup

Step 12 of 24

Install and initialize Altified

Run one initializer from your Next.js project root to wire automatic server translation and locale routing.

Altified supports Next.js 15 or newer with React 18 or newer. The application must use the App Router. Install the package with the same package manager your project already uses.

pnpm
pnpm add @altified/next pnpm exec altified init
npm
npm install @altified/next npx altified init

The initializer detects JavaScript or TypeScript and whether the project uses a src/ directory.

  • Adds missing server-only settings to .env.local.
  • Creates the server client in lib/altified.
  • Creates proxy.js or proxy.ts for locale routing.
  • Wraps the existing Next config with withAltified for automatic JSX translation.

The initializer does not add visible UI or modify your root layout. You place the language switcher yourself in the exact header, navigation, or other component where it belongs.

Read the command output. A Kept line means an existing file or value was preserved. A warning means the initializer could not safely recognize a custom config; follow the manual example in the next step.

When new copy is not discovered

Next.js records automatic translation sources while the application is being compiled. If newly added copy does not appear, remove the generated .next directory and restart or rebuild the application.
Development
rm -rf .next pnpm dev
Production
rm -rf .next pnpm build pnpm start

Visit the page containing the new copy in the default language and each configured target language. You do not need to run pnpm install or pnpm exec altified init again.