Application framework integrations
The framework integrations adapt the shared localization runtime to the state and request models of each supported application framework. They expose one translation experience while defining where locale conditions live, how catalogs reach rendering code, and which setup must run before an application handles work.
Integration model
Each adapter connects four boundaries: framework setup, locale and request conditions, translation catalog access, and rendering APIs. The shared React core supplies the common provider and lookup model. Each adapter chooses storage and life-cycle rules that fit its host runtime.
| Boundary | Purpose | Typical adapter responsibility |
|---|---|---|
| Setup | Establish configuration and runtime services | Initialize locale data and the translation cache before use |
| Provider | Make conditions and catalogs available to UI code | Bind a framework provider to the shared rendering context |
| Cache | Load and reuse translations and dictionaries | Use server loaders, browser data, or an application callback |
| Request | Select locale, region, and translation enablement | Read request data or client state and keep it in the right scope |
The main paths are React integration, Next.js integration, and alternative framework integrations. React is the shared UI base. Next.js adds server, route, build, and client-navigation boundaries. Vue, React Native, and TanStack Start use the same localization concepts with different application life cycles.
Runtime boundaries
The runtime separates data that can be shared from data that must follow a request or application instance. Configuration and cache services are initialized for the runtime. Locale conditions are then read through a provider or request scope before translation content is rendered.
Browser and native state
Browser and native adapters keep locale state writable so a user can change it. Browser state uses cookies and reloads or refreshes the document through the adapter's reload boundary. React Native state uses native storage on native platforms and keeps a stable translation store inside the provider. Both providers send updated conditions back through the shared provider so the component tree can render again. Configured locale aliases remain the user-facing values used by selectors, cookies, and cache lookups.
References: packages/…/BrowserGTProvider.tsx• L15-101 packages/…/BrowserConditionStore.ts• L41-89 packages/…/createBrowserConditionStore.ts• L34-67 packages/…/NativeGTProvider.tsx• L19-41 packages/…/NativeConditionStore.ts• L30-95
Server request state
Server adapters keep locale conditions isolated from other requests. The Node runtime uses an async request scope around application entry points. Next.js and TanStack Start establish an equivalent scope through their server request boundaries. Server providers read that state and pass resolved catalogs into client-capable rendering. This prevents one request's locale from becoming another request's locale.
Server-rendered apps use the server-provided locale and condition values as the rendered state. A condition setter writes the selected value for later request handling and asks the host to refresh or reload. Provider-free SPA apps keep their cookie-backed behavior instead of using this server snapshot rule.
Next.js also keeps the public locale path and the internal route path aligned before rendering. A configured locale spelling is the identity used by routes and client state. A canonical locale code describes the language identity behind that spelling. Several configured spellings can therefore share one canonical code without collapsing their public routes.
References: packages/…/withGT.ts• L1-8 packages/…/AsyncConditionStore.ts• L24-85 packages/…/AsyncConditionStore.test.ts• L13-25 packages/…/createNextMiddleware.ts• L98-117 packages/…/createMiddlewareRouting.ts• L53-72 packages/…/gtMiddleware.ts• L7-16 packages/…/requestConditions.localeAliases.test.ts• L20-77
Provider and cache flow
The provider is the handoff point between an adapter and shared UI translation features. The adapter resolves active conditions, obtains catalogs through its cache boundary, and gives both to the shared provider so components and hooks use one consistent view.
This diagram shows the common flow from application setup to localized rendering.
flowchart LR
A[Application setup] --> B[Locale and request conditions]
B --> C[Provider boundary]
C --> D[Translation and dictionary cache]
D --> E[Shared UI runtime]
E --> F[Localized components and lookups]
F --> G[Locale change]
G --> B
The shared provider receives translation snapshots and optional dictionary data. React and Next.js usually obtain data before rendering. Vue and React Native can load a catalog through their provider life cycle. Next.js resolves the server locale and cache data first, then sends a snapshot to its client boundary so server-rendered content and browser state start from the same conditions. Next.js server formatting components such as RelativeTime also read the active request conditions before delegating to the shared React renderer, so formatted values use the same locale as surrounding content and can remain inside translated content. The shared variable identity for this formatted content stays aligned with extraction and runtime lookup.
React lookup hooks keep a stable function identity across renders. In development, runtime responses refresh direct, memoized, and effect-derived lookups, including lookups made by children rendered after React yields; memoized dictionary objects receive the new values as well. This keeps development hot reload aligned with ordinary rendering and React's concurrent scheduling.
The TanStack Start client provider wraps the shared React provider and supplies the client reload hook created during browser setup. This keeps locale changes inside the application's route flow when locale routing is enabled, while still allowing an explicit reload callback.
References: packages/…/GTProvider.tsx• L9-42 packages/…/client-boundary.tsx• L41-113 packages/…/RelativeTime.tsx• L1-16 packages/…/index.types.ts• L169-189 packages/…/BrowserGTProvider.tsx• L15-92 packages/…/GTProviderProps.ts• L10-21 packages/…/BrowserGTProvider.test.tsx• L100-132 packages/…/clientHooks.test.tsx• L91-125 packages/…/clientHooks.test.tsx• L144-191 packages/…/clientHooks.test.tsx• L217-283 packages/…/GTProvider.client.tsx• L1-10 packages/…/initGT.test.ts• L117-135
Cache ownership
Cache ownership follows the host runtime. React uses a cache service supplied during setup. Next.js keeps server dictionaries and translation loaders on the server while its browser side consumes server-provided data and uses a client-safe cache. Browser React can persist runtime translations across cache recreation. Vue keeps catalogs in its plugin instance. The cache life must match state life: a server request needs isolation, while a browser or Vue application can reuse its loaded catalogs.
Next.js initialization keeps an existing server cache when setup runs again. Its server path can also enable development hot reload from runtime credentials. In development, the configured GT_API_KEY may be exposed to client code for that hot-reload path. Production builds do not expose a development key. Its client path uses the React cache rather than the server-only Next.js cache.
References: packages/…/ReactI18nCache.ts• L1-5 packages/…/BrowserI18nCache.ts• L22-78 packages/…/BrowserI18nCache.localeAliases.test.ts• L12-65 packages/…/GTProvider.tsx• L9-29 packages/…/initGT.test.ts• L46-135 packages/…/runtimeCredentials.ts• L1-19 packages/…/state.ts• L81-140
Catalog handoff
Server-aware adapters complete the cache read before they cross into client rendering. Next.js loads the active locale's translations and dictionaries, then passes snapshots and server conditions to its client provider. React's server and browser providers use the same shared context shape, but each creates the condition store that belongs to its side of the boundary.
The browser provider treats a fresh server snapshot as authoritative for the current render. A rejected locale change can return the old server locale, so the browser keeps that server value while preserving local UI state and carrying the requested value into the next navigation.
References: packages/…/GTProvider.tsx• L18-40 packages/…/client-boundary.tsx• L41-113 packages/…/BrowserGTProvider.tsx• L15-37 packages/…/GTProviderProps.ts• L10-21 packages/…/BrowserGTProvider.test.tsx• L100-132 packages/…/ServerGTProvider.localeAliases.test.tsx• L25-60
Setup boundaries
Setup is split by runtime so browser-only state does not enter server code and server request state does not leak into a long-lived client process. A framework entry point selects the correct setup path and then exposes its framework-native API.
| Runtime | Setup boundary | Result |
|---|---|---|
| React server-rendered | initializeGT from the server entry point | Shared configuration and React cache are ready for server rendering |
| React browser SPA | initializeGTSPA from the browser entry point | Browser cache, writable conditions, and initial translations are ready |
| Next.js | Server, client, RSC, middleware, and worker-aware entry points | The package selects APIs and cache rules for each Next.js execution mode |
| Vue | createGT or initializeGTSPA | A plugin owns locale state and its catalog cache |
| React Native | initializeGT and GTProvider | Native conditions and asynchronous catalog loading are available to the app |
| TanStack Start | Server or client initializeGT plus a framework provider | Request middleware or browser state supplies conditions and route-aware reloads to shared React APIs |
Next.js setup carries non-secret runtime configuration to the relevant server and client boundaries. It selects whether the installed Next.js version supports a server component refresh after a locale change. The server initializer owns the Next.js cache, while the client initializer uses a browser-safe React cache. Development hot reload can pass the development runtime key to client code. Production builds omit that key. The Next.js package installs the compiler as a regular dependency and publishes its compiler asset, so the experimental Babel or SWC build path is available without a separate compiler install.
Compatibility boundaries
Each adapter also declares the host versions that it can support. These package contracts keep a framework from selecting an integration whose provider or runtime entry cannot run in the application.
| Adapter | Host contract |
|---|---|
| React | React and React DOM 18 or newer |
| Next.js | Next.js >=13.0.0, excluding 15.2.1 and 15.2.2, with React and React DOM >=16.8.0 and <20.0.0 |
| Vue | Vue 3.3 through the Vue 3 release line |
| React Native | React 19 or newer with React Native 0.78 or newer |
| TanStack Start | @tanstack/react-start 1.159 or newer with React and React DOM 16.8 or newer |
These are peer contracts rather than a second localization policy. A host upgrade can change which runtime entry, server boundary, or client transition the adapter can safely use, so the package range and the integration behavior must remain aligned.
References: packages/…/package.json• L15-23 packages/…/package.json• L9-17 packages/…/package.json• L6-30 packages/…/package.json• L13-20 packages/…/package.json• L98-115 packages/…/package.json• L13-22 packages/…/config.test.ts• L90-99
Next.js configuration boundary
withGTConfig is the build boundary for a Next.js application. It combines GT settings with the user's Next.js configuration, makes safe runtime settings available to server and client code, and connects configured dictionaries, loaders, request functions, and compiler support to the build. It accepts both object and function forms of Next.js configuration, including functions that return a promise.
The function form preserves the user's phase and context resolution before applying the GT configuration. This lets GT compose with other Next.js configuration plugins instead of treating a configuration function as a plain object. The boundary also resolves the installed Next.js version in ESM configuration files, so next.config.mjs and other module-based config forms use the same version-aware setup.
The boundary keeps production credentials out of client configuration. It also checks that GT locale settings agree with Next.js internationalized routing and rejects missing loader files, conflicting settings, invalid service locales, and development credentials in production. When it compares a config file with Next.js locale settings, the effective GT locale set includes the GT default locale because GT always supports it. Duplicate values and order do not create a false mismatch. In development, the runtime key is intentionally available to client code only when hot reload is enabled. Production builds omit that key. The result is a single configuration contract for middleware, providers, request helpers, and build tools. The published package also carries the compiler asset needed by the Next.js build path.
withGTConfig also carries middleware routing options into the build configuration. createNextMiddleware options override those values at request time. In development, the middleware warns when its prefixDefaultLocale or enableSmartRouting values differ from the values that gt-next/link reads from withGTConfig, because links must make the same prefix choice as middleware.
The configuration also publishes whether the detected Next.js version supports the locale refresh path. This lets the client boundary choose a server component refresh when available and retain a document reload when it is not.
References: packages/…/config.ts• L105-149 packages/…/config.ts• L149-220 packages/…/config.ts• L249-359 packages/…/config.ts• L643-805 packages/…/withGTConfigProps.ts• L47-106 packages/…/runtimeCredentials.ts• L1-19 packages/…/nodeCompat.ts• L1-21 packages/…/createErrors.ts• L46-71 packages/…/createErrors.ts• L101-147 packages/…/config.test.ts• L90-194 packages/…/config.test.ts• L463-652 packages/…/config.test.ts• L1237-1287 packages/…/config.test.ts• L1446-1470 packages/…/packageExports.test.ts• L127-144 packages/…/package.json• L17-30
The React package exposes distinct server, browser, React Server Component, and worker runtime entry conditions. Unsupported calls fail at the wrong boundary instead of silently creating shared state. Next.js follows the same split and marks APIs that belong only to the Pages Router or only to server rendering. TanStack Start also keeps worker and browser exports separate. React Native preserves its native module as an explicit side-effect entry while exposing a web-safe package surface. Vue publishes separate CommonJS and ESM package entry points for Vue 3 consumers.
References: packages/…/index.server.ts• L7-45 packages/…/index.client.ts• L3-16 packages/…/index.rsc.ts• L1-30 packages/…/package.json• L72-134 packages/…/index.client.ts• L19-43 packages/…/index.rsc.ts• L1-19 packages/…/index.server.ts• L1-18 packages/…/client-boundary.tsx• L1-19 packages/…/package.json• L56-121 packages/…/package.json• L48-68 packages/…/package.json• L8-59 packages/…/package.json• L54-89 packages/…/package.json• L54-64 packages/…/packageExports.test.ts• L44-125
Request setup
Request setup must run before request-dependent localization APIs. A plain Node application selects a locale from request headers and wraps the handler with that locale. Next.js reads routing and request inputs through its condition store. TanStack Start uses global request middleware to create the active scope before server routes, server functions, or SSR code read locale state.
Next.js middleware configuration has one shared contract. Defaults enable locale routing and smart routing without a default-locale prefix. Values from withGTConfig override those defaults, while options passed directly to createNextMiddleware have the final precedence. Invalid configuration passed through the build environment is ignored after a diagnostic, so the explicit middleware options remain usable.
Next.js middleware detects locale candidates in this order: the path or a configured default-locale alias, an explicit reset choice, the locale cookie, the referrer locale, the browser language header when enabled, and the configured default. It returns a pass-through, rewrite, or redirect response. It also writes the selected locale to the response so later provider and client code use the same identity. With smart routing disabled and default-locale paths unprefixed, a returning visitor's ordinary unprefixed URL selects the default locale. A first document visit still uses browser language preferences, and an explicit default-locale prefix persists that choice through the redirect.
Next.js routing supports shared paths, locale-specific aliases, locale-specific route overrides, and locale availability rules. pathConfig maps a shared path to a public alias. routeOverrides selects a separate internal page path. localeRoutes limits which shared paths a locale can serve. Dynamic, catch-all, optional catch-all, encoded, base-path, and trailing-slash forms remain part of the same public-to-internal route contract.
Next.js links use the same public locale path rules before navigation. gt-next/link wraps Next.js Link, while useLocalizeHref supports navigation APIs such as router.push; server code can use getLocalizeHref or the server version of useLocalizeHref. Internal paths receive the current or requested locale when middleware would use a prefix. External URLs remain unchanged, and locale={false} leaves a path untouched. A pathRegex can leave selected unprefixed paths unchanged. A path that already contains a locale is still treated as an unlocalized input and produces a development warning. The warning does not change the href, but it identifies a link that can receive a doubled prefix.
Pages Router integrations can delegate active-locale resolution to Next.js internationalized routing. The client boundary keeps server-rendered content aligned with the browser path: it refreshes server components after a locale change when the installed Next.js version supports it, and otherwise reloads the page. It reloads the browser when adding or removing a default-locale path prefix requires navigation. The package selects these behaviors from the detected Next.js and React versions. TanStack Start's client provider applies the same route-aware handoff through its client setup before shared React code handles the change.
References: packages/…/getRequestLocale.ts• L8-39 packages/…/withGT.ts• L3-8 packages/…/localeValidation.ts• L19-46 packages/…/defaultMiddlewareConfig.ts• L3-35 packages/…/resolveMiddlewareConfig.ts• L8-41 packages/…/createMiddlewareRouting.ts• L28-193 packages/…/createNextMiddleware.ts• L23-79 packages/…/createNextMiddleware.ts• L94-168 packages/…/createNextMiddleware.ts• L170-407 packages/…/Link.tsx• L11-78 packages/…/localize-utils.ts• L21-91 packages/…/useLocalizeHref.ts• L5-45 packages/…/getLocalizeHref.ts• L6-55 packages/…/server.ts• L10-28 packages/…/client-boundary.tsx• L52-105 packages/…/getStableNextVersionInfo.ts• L84-128 packages/…/gtMiddleware.ts• L7-16 packages/…/initializeGT.client.ts• L16-40 packages/…/GTProvider.client.tsx• L1-10 packages/…/middleware.edge.test.ts• L94-216 packages/…/Link.test.tsx• L59-216 packages/…/pagesRouter.test.ts• L111-157
Framework choices
The supported adapters share translation features but differ in the boundary that starts and ends a localization context. Use the child page that matches the host application before changing provider, cache, request, or setup behavior. The React integration, Next.js integration, and alternative framework integrations pages describe those host-specific choices.
| Host | Main localization boundary | Child page |
|---|---|---|
| React | Provider plus server or browser entry point | React integration |
| Next.js | Build configuration plus server, client, RSC, worker, request, locale-path routing, and localized-link support | Next.js integration |
| Vue 3 | Installed plugin with instance-scoped state and cache | Alternative framework integrations |
| React Native | Native storage, provider loading, and app life cycle | Alternative framework integrations |
| TanStack Start | Request middleware plus server and client providers | Alternative framework integrations |
| Other Node server | Explicit initialization, request locale selection, and async scope | Alternative framework integrations |
The adapter choice affects more than the component import. It determines how the active locale is found, when catalogs are ready, how locale changes reach the UI, and which setup is safe for the execution environment. Locale aliases add one shared concern across adapters: route, cookie, selector, cache, and request code must use the configured spelling while translation services can use the mapped canonical code.
References: packages/…/parseLocale.test.ts• L17-75 packages/…/pagesRouter.test.ts• L111-157 packages/…/requestConditions.localeAliases.test.ts• L20-77 packages/…/parseLocale.test.ts• L106-175 packages/…/package.json• L1-20 packages/…/package.json• L1-15 packages/…/package.json• L1-23 packages/…/package.json• L1-22
Change checklist
When these files or sections are changed, remember to consider these:
- Keep server, browser, RSC, middleware, and worker exports aligned with the state each boundary can safely access.
- If a provider input changes, check the matching condition store and the catalog snapshot handoff.
- If cache life or loading changes, check whether the adapter still isolates server requests and reuses client catalogs as intended.
- If locale selection changes, check request middleware, cookies or native storage, and the client transition path together.
- If smart routing policy changes, check first-visit negotiation, returning-visitor cookies, explicit default-locale prefixes, and background requests together.
- If a framework adds a setup step, check that its package entry point and child integration page describe the same ordering.
- If a framework provider delegates to the shared React provider, check that its client setup supplies the correct reload and route handoff.
- If the Next.js client boundary changes, check both route matching and the choice between refreshing server components and reloading the browser page.
- If locale mappings or storage names change, check every adapter that reads or writes the related request or client state.
- If a platform export changes, check that native side effects remain available on native targets and that web consumers do not load native modules.
- If Next.js loader or dictionary aliases change, check that server-only resources remain out of browser bundles and still resolve in the supported bundlers.
- If Next.js middleware path rules change, check aliases, route overrides, locale availability, dynamic and catch-all paths, encoded path segments, base paths, and trailing-slash preservation as one routing contract.
- If Next.js version gates change, check the provider refresh behavior, compiler support, worker exports, and configuration fields together.
- If the Next.js build asset, compiler dependency, or package export map changes, check that published compiler support and runtime-specific entry points remain available to their intended consumers.
- If a package peer range changes, check that its runtime export conditions and the host-version behavior gates still describe the same supported applications.
- If Next.js initialization changes, check that repeated setup keeps the intended cache instance and that client initialization still uses the client-safe cache.
- If runtime credentials change, check the development hot-reload exposure, production omission, legacy environment fallback, and client configuration boundary together.
- If a server formatting component changes its runtime marker or request-condition handoff, check that translated content, extraction, and locale formatting still use the same variable identity.
- If React lookup hooks change, check stable hook identity and development response updates for direct, memoized, effect-derived, dictionary, and scheduler-delayed lookups.
- If shared middleware options change, check
withGTConfig,createNextMiddleware, andgt-next/linkprecedence together. - If localized-link behavior changes, check
<Link>,useLocalizeHref,getLocalizeHref, default-locale prefix rules, external URLs, and prelocalized-path warnings together. - If the Next.js configuration wrapper changes, check object and function-form configs, including async configs, for preserved user settings before GT settings are applied.
- If the Next.js config runtime changes, check that Node-only module loading and asset paths work in both CommonJS and ESM config execution.
- If GT and Next.js locale comparison changes, check the effective locale sets, including the supported GT default locale, duplicate removal, and order-independent matching.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A server request reads locale state outside its async scope | Development errors or an unsafe fallback locale in production | Enter the request through withGT, Next.js request setup, or gtMiddleware before localization calls |
| A browser-only initializer runs from a server entry point | Browser state is created in the wrong runtime or the call fails | Use the runtime-specific package entry point and setup function |
| A worker runtime resolves a browser entry instead of a server entry | SSR can access browser globals or share locale state across requests | Keep worker export conditions ahead of the browser condition in React, Next.js, and TanStack Start package maps |
| A client provider receives no server or loaded catalog | The UI can render source content instead of the requested translation | Complete the server cache read or provider load before relying on translated output |
| A React translation hook changes identity across renders | Effects and memoized values can rerun or lose the expected development update path | Preserve stable hook identities and verify direct and deferred lookups during development hot reload |
| TanStack Start uses its client provider before client initialization | Locale changes can fall back to a full document reload instead of the configured locale route | Run client initialization before mounting the provider and preserve an explicit reload callback when one is required |
| A server snapshot and browser condition store use different locale identities | Hydration or a locale switch can show stale content or select the wrong route | Resolve aliases to configured locale spellings before provider, cookie, and cache handoff |
| Smart routing treats a first document visit like a returning visit | Browser language selection can be replaced by the default locale or an unintended cookie | Keep first-visit detection separate from returning-visitor preference and persist an explicit default choice only for the document redirect |
| Separate Vue plugins serve component and module-level lookups | Locale and catalog state split between two runtimes | Install the exact plugin returned by initializeGTSPA for SPA module-level translations |
| TanStack Start middleware is not global | Server routes and functions have no active request condition scope | Register gtMiddleware as global request middleware |
| Next.js route locale state changes without the client boundary sync | Server components can show the prior locale or the URL can keep the wrong default-locale form | Let the client boundary compare the path with the selected locale and use refresh or reload as required |
| Next.js middleware maps a localized route to the wrong internal shape | A request can redirect in a loop, render the wrong page, or lose route parameters | Keep shared-path matching, locale aliases, route overrides, availability rules, and rewrite targets aligned |
| Next.js middleware normalizes an encoded or malformed path incorrectly | A valid route can miss or a redirect can change the requested resource | Normalize path segments independently and preserve dynamic values, base paths, query strings, and slash style |
| A configured locale alias is collapsed to its canonical code in a route or cookie | The public URL, cache key, or selector no longer matches the configured application locale | Keep configured spellings as runtime identities and use canonical codes only for locale resolution |
withGTConfig exposes a production credential or a development key when hot reload is disabled | A private key can reach a browser bundle or a disabled feature can receive unintended credentials | Read supported environment names at setup, expose a key only for development hot reload, and omit development keys from production output |
| React Native's native module is loaded by a web build | Web rendering can fail during package import | Keep the native module lookup guarded and preserve the platform checks |
| Next.js dictionary or loader aliases are not applied by the bundler | Server lookups can silently lack dictionaries or translations | Keep the server alias setup compatible with the supported webpack and Turbopack paths |
| The published Next.js package omits its compiler asset or compiler dependency | The build-time translation path can fail even when runtime entry points resolve | Preserve the package asset and regular compiler dependency and keep the release check that verifies them in full builds |
| An application uses a host version outside an adapter's peer range | Installation or build resolution can fail, or version-gated locale behavior can be wrong | Check the adapter's peer contract before changing the host framework version |
| Next.js setup replaces an existing cache during a second initialization | A running request path can lose its cache state or use a different cache policy | Preserve the first initialized Next.js cache and use the client-safe React cache on the client |
| Development credentials are serialized into client configuration in production | A private key can reach a browser bundle or production can accept a development key | Use GT_PROJECT_ID and GT_API_KEY for runtime setup, allow client exposure only for development hot reload, and omit development credentials from production |
| A Next.js formatting component uses a variable marker that differs from the extractor marker | A translated component can fail at render time or use the wrong value shape | Keep the server component marker and the shared variable identity aligned with extraction and runtime lookup |
createNextMiddleware and withGTConfig use different routing options | Links can create URLs that middleware redirects or normalizes | Set shared routing options in withGTConfig and use middleware options only for intentional request-time overrides |
| A localized link receives a path that already has a locale prefix | The link can receive a doubled locale prefix and navigate to the wrong path | Pass an unlocalized path or use locale={false}; treat the development warning as a routing defect |
| Middleware configuration in the build environment is malformed | The middleware falls back to defaults and may use a different routing policy than expected | Configure middleware through withGTConfig or pass valid options directly to createNextMiddleware |
| A Next.js config function is treated as an object | User config can be lost before the localization settings are applied | Keep function and async-function composition in withGTConfig and preserve the original phase context |
| The Next.js config runs without Node compatibility support in an ESM build | Config loading or compiler asset resolution can fail before the application builds | Keep Node module loading and distribution paths behind the config-only compatibility boundary |
| GT and Next.js locale lists use different effective sets | Configuration emits a mismatch warning and the two routing systems can select different locales | Include the GT default locale in the comparison and keep locale values unique before comparing the sets |
Key files
| File | Why to read it |
|---|---|
| packages/…/InternalGTProvider.tsx | Defines the shared provider handoff between conditions, catalogs, and UI rendering. |
| packages/…/package.json | Shows the framework-neutral React core peer contract and public provider, hook, and component entry points. |
| packages/…/BrowserConditionStore.ts | Shows writable browser conditions, cookie persistence, and server snapshot handling. |
| packages/…/BrowserGTProvider.tsx | Shows the browser provider boundary and reconciliation of server results. |
| packages/…/ServerGTProvider.tsx | Shows the server provider shape used before hydration. |
| packages/…/clientHooks.test.tsx | Protects stable React hook identities and development hot-reload updates across rendered, memoized, effect-derived, dictionary, and deferred lookups. |
| packages/…/index.client.ts | Shows the browser React boundary and its public client surface. |
| packages/…/index.server.ts | Shows the server-rendered React boundary and its protected browser setup APIs. |
| packages/…/initializeGTSPA.ts | Shows browser setup and the initial catalog readiness boundary. |
| packages/…/config.ts | Shows how Next.js build configuration joins GT runtime settings, loaders, aliases, middleware options, locale checks, and version-aware options. |
| packages/…/withGTConfigProps.ts | Defines the configuration boundary shared by build setup and locale middleware. |
| packages/…/runtimeCredentials.ts | Defines supported runtime credential names, legacy fallback, and the development-only key rule. |
| packages/…/nodeCompat.ts | Keeps Node module loading and distribution asset paths available to the plain-Node Next.js config entry. |
| packages/…/GTProvider.tsx | Shows how Next.js resolves request conditions and loads snapshots before client rendering. |
| packages/…/defaultMiddlewareConfig.ts | Defines the default locale routing policy and separates middleware settings from other configuration. |
| packages/…/resolveMiddlewareConfig.ts | Shows the precedence between defaults, withGTConfig, and direct middleware options. |
| packages/…/createMiddlewareRouting.ts | Shows how aliases, route overrides, locale availability, and configured locale identities become routing state. |
| packages/…/createNextMiddleware.ts | Shows how Next.js detects locale state and chooses pass-through, rewrite, or redirect behavior. |
| packages/…/Link.tsx | Shows the locale-aware wrapper around Next.js Link. |
| packages/…/localize-utils.ts | Shows the shared path-prefix and pathRegex rules used by links and programmatic navigation. |
| packages/…/useLocalizeHref.ts, packages/…/getLocalizeHref.ts | Show the client and server APIs for localizing navigation paths outside a rendered link. |
| packages/…/client-boundary.tsx | Shows the Next.js client handoff and synchronization between URL locale state and server-rendered content. |
| packages/…/localeValidation.ts | Shows the boundary between accepted request locales and the configured default. |
| packages/…/RelativeTime.tsx | Shows how a Next.js server formatting component receives request conditions before shared rendering. |
| packages/…/initGT.test.ts | Shows the cache, credential, singleton, and client/server initialization contracts. |
| packages/…/config.test.ts | Shows the build configuration contract, version-gated refresh flag, locale alignment, effective locale comparison, and credential boundary. |
| packages/…/packageExports.test.ts | Protects the Next.js runtime export choices and the published compiler asset boundary. |
| packages/…/middleware.edge.test.ts, packages/…/localeRoutes.edge.test.ts | Protect middleware defaults, locale routing, configuration behavior, path availability, and rewrite or redirect outcomes. |
| packages/…/Link.test.tsx | Protects locale prefix behavior for rendered links and path filtering. |
| packages/…/withGT.ts | Shows the explicit request scope used by general Node applications. |
| packages/…/state.ts | Shows Vue plugin ownership of locale state and catalog cache. |
| packages/…/package.json | Shows the Vue package's supported peer range and public module entry points. |
| packages/…/NativeGTProvider.tsx | Shows native catalog loading and condition updates through the provider. |
| packages/…/package.json | Shows React Native platform exports and the native side-effect boundary. |
| packages/…/gtMiddleware.ts | Shows the TanStack Start request boundary that protects server localization state. |
| packages/…/initializeGT.client.ts, packages/…/GTProvider.client.tsx | Show the TanStack Start browser setup and the provider handoff that keeps locale changes in the route flow. |
| packages/…/package.json, packages/…/package.json, packages/…/package.json | Show the runtime export conditions and host-version contracts that keep worker, server, browser, and RSC consumers on the correct boundary. |
| packages/…/package.json, packages/…/package.json | Show the native and Vue package entry points and their supported host contracts. |