Over-the-air translation updates in Next.js
In a Next.js app, translation files ship with each deploy. This guide fetches them from your latest litei18n release on the server instead, so a text change goes live without redeploying.
Setup steps
Create a release
In litei18n, commit your translations and create a release on the Releases page (Starter plan and above). Copy your project ID from the release URL shown there. Export your translations as JSON too, and add them to your app as the bundled copy.
Load the release when the app starts
Set LITEI18N_PROJECT_ID in your environment and keep your exported JSON files in locales/ as a fallback. revalidate tells Next.js to look for a new release at most every five minutes.
lib/translations.tsconst PROJECT_ID = process.env.LITEI18N_PROJECT_ID; const RELEASES = 'https://ttksowxkfdohtprtfarf.supabase.co/storage/v1/object/public/releases/locales'; export async function getTranslations(locale: string): Promise<Record<string, string>> { try { const res = await fetch(`${RELEASES}/${PROJECT_ID}/latest/${locale}.json`, { next: { revalidate: 300 }, // look for a new release every 5 minutes }); if (res.ok) return await res.json(); } catch { // Network error: fall through to the bundled copy. } // The bundled copy, or English for a language you have not bundled. const bundled = await import(`../locales/${locale}.json`).catch(() => import('../locales/en.json')); return bundled.default; }Use the strings
Call getTranslations in a server component and read keys from the object it returns. Next.js caches the result and fetches a new release in the background.
app/[locale]/page.tsximport { getTranslations } from '@/lib/translations'; export default async function Home({ params }: { params: Promise<{ locale: string }> }) { const { locale } = await params; const t = await getTranslations(locale); return <h1>{t['home.title']}</h1>; }Change text without a new build
Edit a translation, commit it and create a new release. The latest URL now serves the new text, and your app picks it up the next time it loads translations. No new build, no app store review.
Good to know
- Release files are cached on a CDN, so a new release can take a few minutes to show everywhere.
- To pin an app version to one release, use the versioned URL (…/v3/es.json) instead of …/latest/es.json.
- Using next-intl? It reads dots in keys as nesting, so turn the flat keys into nested objects before you pass them in.
Start shipping globally in 5 minutes
Join developers who ship their apps in every language with litei18n.
Free plan available · No credit card required · Set up in under 5 minutes