Skip to content

i18n Setup

NuxtBase ships with two locales in the app:

  • en
  • zh

The routing strategy is:

prefix_except_default

That means:

  • English stays on the default unprefixed routes
  • Chinese uses the /zh prefix

Examples:

/login
/pricing
/docs

are the default English routes, while the Chinese versions look like:

/zh/login
/zh/pricing
/zh/docs

This is a sensible default for English-first products that still want a clean second locale.

FilePurpose
nuxt.config.tsregisters locales and the routing strategy
i18n/i18n.config.tsdate and time formatting rules
i18n/locales/en.jsonEnglish UI strings
i18n/locales/zh.jsonChinese UI strings

The important Nuxt config shape is:

locales: [
{ code: "en", language: "en-US", name: "English", file: "en.json" },
{ code: "zh", language: "zh-CN", name: "中文", file: "zh.json" },
],
defaultLocale: "en",
strategy: "prefix_except_default";

Most interface strings are stored in:

  • i18n/locales/en.json
  • i18n/locales/zh.json

When you change product wording, make the change in both files unless you intentionally want one locale to diverge.

This includes common areas like:

  • navigation
  • auth screens
  • settings
  • admin text
  • email-adjacent UI labels

The template includes a locale switcher component that builds links from the active locale list and the Nuxt i18n switch helper.

This means you usually do not need to hand-build locale URLs in UI components. Reuse the existing locale utilities and switcher behavior.

Inside the core template, the in-app docs content is stored as separate content collections:

  • docs_en
  • docs_zh

Those collections map to:

  • content/docs/en/**
  • content/docs/zh/**

and are exposed with these route prefixes:

  • English docs: /docs
  • Chinese docs: /zh/docs

That separation keeps translated docs content explicit and predictable.

The same principle applies to blog content when you want both English and Chinese blog posts in the app.

Keep localized blog content explicit instead of mixing two languages into one post file.

That means:

  • English blog routes should stay under /blog
  • Chinese blog routes should use /zh/blog
  • translated blog posts should be maintained as separate localized content entries

This gives you a clean split between:

  • English-first marketing and SEO pages
  • Chinese blog discovery pages
  • per-locale blog copy, titles, descriptions, and metadata

If you only have bandwidth for one blog language at launch, keep the second locale out of the blog until you are ready to maintain it properly. Partial blog translation usually creates a worse experience than clearly shipping one complete language first.

Locale-specific date formats are defined in i18n/i18n.config.ts.

Examples:

  • English short dates use month names like Apr 1, 2026
  • Chinese short dates use numeric formatting

If you want locale-aware dates across the app, extend that config instead of formatting dates ad hoc in random components.

  1. keep English as the default locale unless you have a strong reason to change it
  2. update branding and product naming in both locale files
  3. test the locale switcher in the UI
  4. verify route prefixes behave correctly under /zh
  5. only then expand translated docs, blog content, or product copy

This creates obvious quality gaps and makes the app feel unfinished.

Prefer Nuxt i18n helpers and the existing locale switch flow instead of hand-building locale URLs.

The app locale JSON files are for UI strings. Docs and blog content should live in their own localized content structures. Keep those responsibilities separate.