Back
gt-nextv11.1.3nextjspages-routeri18nlocale-routing
BlogChangelog

gt-next 11.1.3: Native locale routing for Pages Router

Ernest McCarter

Overview

gt-next v11.1.3 uses Next.js internationalized routing for Pages Router apps. Next.js now owns locale-prefixed URLs, request locale context, browser detection, and client navigation, while gt-next loads the matching translation snapshot. Follow the updated Next.js Pages Router Quickstart for the complete setup.

Configure Pages Router locales

Import the same locale settings into next.config.ts that you use in gt.config.json:

import type { NextConfig } from 'next';
import { withGTConfig } from 'gt-next/config';
import gtConfig from './gt.config.json';

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

export default withGTConfig(nextConfig);

The locales array must include defaultLocale. Pages remain directly under pages; a pages/[locale] segment and gt-next middleware are no longer part of the recommended Pages Router setup.

withGTServerSideProps and withGTStaticProps read the locale from the Next.js data-function context. Locale selection uses locale-aware Pages Router navigation and the NEXT_LOCALE preference cookie.