Internationalization
Internationalization
NextDevTpl uses next-intl for UI translations and locale-aware routing. Documentation content is localized through Fumadocs content folders.
Current locales
Locales are configured in:
src/i18n/routing.ts
Current values:
locales: ["en", "zh"]
defaultLocale: "en"
UI messages
| File | Purpose |
|---|---|
messages/en.json | English UI copy |
messages/zh.json | Chinese UI copy |
src/i18n/request.ts | Loads locale messages |
src/features/shared/components/language-switcher.tsx | Header language switcher |
Use useTranslations() in client components and server translation helpers in server components.
Route structure
Most pages live under:
src/app/[locale]
Examples:
/en
/zh
/en/dashboard
/zh/dashboard
/en/docs
/zh/docs
Documentation i18n
Docs are stored by language:
src/content/docs/en
src/content/docs/zh
The loader in src/lib/source.ts uses Fumadocs i18n with the dir parser. The docs route reads pages by params.locale, so /en/docs and /zh/docs get separate page trees.
Adding a locale
- Add the locale to
src/i18n/routing.ts. - Add
messages/<locale>.json. - Add docs under
src/content/docs/<locale>. - Add blog/legal content if those routes should support the locale.
- Update sitemap metadata if needed.
- Test navigation and language switching.
Translation quality
Do not mechanically translate product terms that are better left in English. Keep framework and API names unchanged: Next.js, Drizzle, Better Auth, Creem, Inngest, Sentry, Axiom, Fumadocs, next-intl.