ShiftFast Docs

Internationalization

Locale routing and message files via next-intl.

Every route lives under src/app/[locale]/. Routing is configured in src/i18n/routing.ts:

export const routing = defineRouting({
  locales: ['en', 'fr'],
  defaultLocale: 'en',
  localePrefix: 'as-needed',
})

localePrefix: 'as-needed' means the default locale (en) has no URL prefix (/pricing), while non-default locales do (/fr/pricing).

Message files

Translation strings live in src/i18n/messages/en.json and fr.json, namespaced by feature area (nav, billing, planAction, planPrompt, errors, etc.) and accessed via useTranslations('namespace').

src/i18n/navigation.ts exports locale-aware Link and redirect helpers — use these instead of next/link and next/navigation anywhere a link or redirect needs to preserve the current locale.

Clerk localization

Clerk's own hosted UI is localized separately via @clerk/localizations, mapped per app locale (enUS, frFR) and passed to <ClerkProvider localization={...}> in the root layout.

Adding a locale

This walks through adding a third locale (e.g. de) alongside the shipped en/fr.

Add the new locale to src/i18n/routing.ts:

export const routing = defineRouting({
  locales: ['en', 'fr', 'de'],
  defaultLocale: 'en',
  localePrefix: 'as-needed',
})

Add a matching message file, src/i18n/messages/de.json, mirroring every key in en.json.

Missing keys fall back silently — easy to miss in review. Diff the two files' key sets before merging.

If @clerk/localizations ships a bundle for the language (most major languages do), import and map it in src/app/[locale]/layout.tsx's clerkLocaleMap, keyed by the new locale.

generateStaticParams() in src/app/[locale]/layout.tsx returns routing.locales.map(...) — since it reads from routing.locales directly, adding the locale in step 1 is enough; there's nothing extra to update there.

On this page