Skip to content

docs(react): document the Pages Router i18n config mismatch warning - #432

Open
moss-bryophyta wants to merge 1 commit into
mainfrom
docs/i18n-config-mismatch-warning
Open

docs(react): document the Pages Router i18n config mismatch warning#432
moss-bryophyta wants to merge 1 commit into
mainfrom
docs/i18n-config-mismatch-warning

Conversation

@moss-bryophyta

Copy link
Copy Markdown
Contributor

What

Documents the build-time warning added by gt#2005, shipped in gt-next@11.1.4 (published 2026-07-30).

When next.config.ts's i18n.locales / i18n.defaultLocale disagree with gt.config.json, gt-next now prints a warning at build time. Nothing in the docs mentioned it.

Why it matters

Both Pages Router pages already show the correct pattern — importing the values out of gt.config.json so the two configs cannot drift:

const nextConfig: NextConfig = {
  i18n: {
    locales: gtConfig.locales,
    defaultLocale: gtConfig.defaultLocale,
  },
};

Neither page explained why that import matters. A reader who hardcodes the arrays instead (a natural thing to do) gets a warning with no docs to search for. This adds the missing rationale and names the warning.

Changes

  • react/(frameworks)/nextjs/pages-router-middleware.mdx — one paragraph after the config block explaining that importing keeps the two configs in sync, what the warning says, and that the locale comparison is order-independent.
  • react/nextjs-pages-router-quickstart.mdx — one clause noting the values should be imported rather than repeated, and that gt-next warns when they disagree. Kept short since this page already links to the routing page for details.

I left pages-router-static-site-generation.mdx alone — it already says to import from gt.config.json and links to the routing page for complete setup, so a third copy would be redundant.

Verification

Behavior confirmed against the published gt-next@11.1.4, not just main:

gt-next (plugin) Warning: Next.js internationalized routing does not match
the GT config file because next.js may select a locale that GT is not
configured to translate. ...

Order-independence and the defaultLocale-prepend normalization are confirmed in getNextI18nConfigMismatches / haveSameLocales in packages/next/src/config.ts. The check is deliberately scoped to file-loaded config only — inline props passed to withGTConfig go through the existing conflict/merge paths and do not trigger this warning, so I did not claim otherwise in the docs.

All five validators pass, and pnpm run build:content succeeds (328+ paths).

Related

While verifying the exact warning text I found the shared diagnostic formatter lowercases proper nouns, rendering because next.js may select.... Filed upstream as gt#2016. The docs here deliberately describe the warning's meaning rather than quoting the mangled string, so this PR stays correct either way.

gt-next@11.1.4 (gt#2005) warns at build time when next.config i18n
locale settings disagree with gt.config.json. Both Pages Router pages
already import from gt.config.json; explain why that pattern matters
and name the warning users see if the values drift.
@moss-bryophyta
moss-bryophyta enabled auto-merge (squash) July 31, 2026 13:26
@moss-bryophyta
moss-bryophyta requested review from archie-mckenzie and pie575 and removed request for fernando-aviles August 1, 2026 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant