Skip to content

gt-next@11.0.0

Choose a tag to compare

@github-actions github-actions released this 04 Jul 02:32
· 126 commits to main since this release
858323a

Major Changes

  • #1816 463a8db Thanks @bgub! - Add a config-aware resolveCanonicalLocale helper and remove the public getGTClass helper.

  • #1439 e12fb17 Thanks @ErnestM1234! - Prepare Odysseus major releases for core runtime packages.

  • #1816 463a8db Thanks @bgub! - Remove the deprecated useGTClass hook from public entry points.

  • #1821 40db0c5 Thanks @bgub! - Remove useVersionId from public package entrypoints.

    The getVersionId helper remains available from public function entrypoints and gt-i18n/internal.

  • #1439 8a2f7ee Thanks @ErnestM1234! - Simplify translation option types. Replace deprecated inline and dictionary option aliases with GTTranslationOptions, use interpolation variables for dictionary t() options, and trim higher-level type exports to avoid exposing internal translation option fields.

Patch Changes

  • #1439 8870496 Thanks @ErnestM1234! - Use Next.js caching semantics for Cache Components by disabling GT cache expiry and development hot reload runtime translation.

    Async translation and dictionary lookup boundaries now keep synchronous access to the loaded snapshot, so APIs like getGT and getTranslations can still resolve strings after cache expiry is delegated to Next.js.

    Global singleton setup now preserves the first initialized instance instead of replacing it on later initialization attempts.

  • #1824 1a483ae Thanks @ErnestM1234! - Remove deprecated Next internal packages.

  • #1439 7a9dbe3 Thanks @ErnestM1234! - Clean up stale package metadata and align TanStack Start package entry points.

  • #1815 1212135 Thanks @bgub! - Clean up the @generaltranslation/react-core public API surface.

    • @generaltranslation/react-core: Removed dead dictionary helper exports and source files, stopped exporting JSX serialization internals from /pure, dropped internal singleton/plumbing exports from /pure, removed useShouldTranslate from /hooks, and kept only internalInitializeGTSRA for the server-rendered initializer.
    • gt-react: Aliases internalInitializeGTSRA locally from the RSC entrypoint so the public initializeGT export remains unchanged.
    • gt-next: Replaced imports of removed react-core legacy types with equivalent local types.
  • #1439 04f419d Thanks @ErnestM1234! - Fix source interpolation for default-locale string helpers.
    Clarify that tx() does not apply ICU formatting by default.

  • #1439 bd52e5e Thanks @ErnestM1234! - Allow client i18n cache expiry to default to no expiry while preserving explicit cache expiry configuration.

  • #1439 98698de Thanks @ErnestM1234! - Escape backslashes in middleware path regex input before dynamic path matching.

  • #1659 807dc30 Thanks @ErnestM1234! - Add a locale-aware Link component for Next.js applications.

    Transpile gt-next in Next apps so package runtime config is compiled with app env values. See #1661.

  • #1439 72e9e16 Thanks @ErnestM1234! - Split the runtime surface of the GT class (locale management, formatting, runtime translation) into a GTRuntime base class exported from the new generaltranslation/runtime entry point. The SDK runtime (gt-i18n's I18nConfig, gt-next middleware) now constructs GTRuntime, so production browser bundles no longer ship the project/file management API client (enqueueFiles, uploads, downloads, etc.). The GT class extends GTRuntime and keeps its full API for the CLI and other tooling. Also import getLocaleProperties from @generaltranslation/format directly in react-core so client bundles don't reach the full core entry.

  • #1439 8870496 Thanks @ErnestM1234! - Support dev hot reload lookups for server getGT strings.

    getGT can now receive compiler-injected message metadata and prefetch missing translations through the runtime cache in development. gt-next forwards the server request conditions into this path so App Router server strings can participate in hot reload translation updates.

    Compiler-injected getGT and useGT preload messages now emit the same sugar metadata keys used by runtime lookup options.

  • #1439 8d2e84e Thanks @ErnestM1234! - Preserve enableI18n hydration state from server props and request cookies.

  • #1439 361e158 Thanks @ErnestM1234! - Stop forwarding locale={false} from gt-next/link to the underlying Next.js link after localizing the href.

    This avoids React DOM warnings in newer Next.js versions where the control prop can reach the rendered anchor.

  • #1439 04b5064 Thanks @ErnestM1234! - Restore namespace scoping for getTranslations and server useTranslations.

  • #1439 ca7218e Thanks @ErnestM1234! - Ship a dual ESM/CJS build for gt-next and add import export conditions.

    Previously gt-next was published as CJS only (no import condition), so bundlers resolved the entire gt dependency graph (gt-react, @generaltranslation/react-core, generaltranslation, gt-i18n, @generaltranslation/format) through the require condition. That forced CJS variants onto the client, which cannot be tree-shaken — shipping gt-next's own server/error code and unused dependency exports to the browser.

    gt-next now emits unbundled .mjs output alongside the existing .js output, and every exports subpath exposes an import condition. Bundlers now resolve the gt graph as ESM, enabling tree-shaking across all gt packages. Measured on a real Next.js app, this cuts gt's total client bundle by ~19% gzip (≈96 kB → ≈78 kB) with no API changes.

    The ESM build sets polyfillRequire: false so rolldown does not inject a package-wide createRequire-from-node:module shim, keeps custom request function imports visible to bundler aliases, and marks the index.rsc/index.client entrypoints as having side effects so their top-level initialization is not tree-shaken away.

  • #1439 1f10252 Thanks @ErnestM1234! - Point the react-server export condition at the RSC-specific declaration file so TypeScript no longer exposes client-only hooks in React Server Components.

  • #1439 b3bb391 Thanks @ErnestM1234! - Store cookie names in I18nConfig so custom cookie names work before the condition store is initialized.

    • gt-i18n: Removed the unused React locale cookie name from the shared GT config type.
    • @generaltranslation/react-core: ReactI18nConfig now accepts localeCookieName, regionCookieName, and enableI18nCookieName, exposes getters that fall back to the default names, and exports the default storage names from the pure entrypoint.
    • gt-next: Imports default cookie names from the React Core pure entrypoint instead of the removed React Core cookie constants subpath.
    • gt-react: The browser condition store now resolves cookie names from I18nConfig instead of hardcoding the defaults, so custom cookie names passed to initializeGT() are honored for both reads and writes.
    • gt-react-native: Native condition storage now resolves its store keys from I18nConfig, matching gt-react behavior.
    • gt-tanstack-start: parseLocale() reads and writes the locale cookie using the configured cookie name instead of the default.
  • #1439 0a6a11c Thanks @ErnestM1234! - Keep the locale cookie when the middleware clears the setLocale reset cookie. Deleting it raced with concurrent prefetch responses after a locale switch in production builds, causing client components to fall back to the browser's default locale while server components rendered the selected locale.

  • #1439 cecb3e1 Thanks @ErnestM1234! - Delegate remote translation loading to the shared i18n cache and only pass custom Next.js translation loaders when configured.

  • #1439 d48604e Thanks @ErnestM1234! - Trigger an odysseus prerelease patch for all publishable packages.

  • #1439 5752fe8 Thanks @ErnestM1234! - Organize package entrypoint exports and replace re-export-only imports with direct export declarations.

  • #1439 294791a Thanks @ErnestM1234! - Add a Pages Router server-side props helper for GT locale and translation snapshots.

  • #1439 97dc7f4 Thanks @ErnestM1234! - Remove default exports from package entrypoints and internal source modules.

    Use named imports for affected public entrypoints, including import { plugin } from 'gt-react-native/plugin'. The gt-next/link entrypoint keeps its default export to match next/link.

  • #1439 ee688b2 Thanks @ErnestM1234! - Read Next runtime credentials from environment variables and keep them out of serialized config.

  • #1439 a8876d4 Thanks @ErnestM1234! - Initialize gt-next server entrypoints with a shared server condition store.

  • #1822 ce8a665 Thanks @bgub! - Clean up the gt-next API surface for the next major prerelease.

    Removes the deprecated initGT config alias and the redundant gt-next/types subpath. Moves the hidden dictionary and loader subpaths under gt-next/internal/*, updates the Next config alias plumbing to match, and adjusts CLI setup detection so it no longer treats initGT as a valid existing config wrapper.

  • #1439 384be28 Thanks @ErnestM1234! - Remove 21 unused error/warning builders from gt-next's errors/createErrors.ts.

    The following had no consumers anywhere: createDictionaryTranslationError, createInvalidDictionaryEntryWarning, createInvalidDictionaryTranslationEntryWarning, createInvalidIcuDictionaryEntryError, createInvalidIcuDictionaryEntryWarning, createMismatchingHashWarning, createNoEntryFoundWarning, createRequiredPrefixError, createStringRenderError, createStringRenderWarning, createStringTranslationError, createTranslationLoadingWarning, dictionaryDisabledError, dictionaryNotFoundWarning, gtProviderUseClientError, missingVariablesError, noInitGTWarn, runtimeTranslationTimeoutWarning, txUseClientError, unresolvedGetLocaleBuildError, usingDefaultsWarning. ~155 LOC of dead error-string code removed.

  • #1439 bd02086 Thanks @ErnestM1234! - Remove the unused getDomain request-function plumbing from gt-next.

    getDomain was scaffolded (a throw-only internal/_getDomain stub, a getDomainPath config prop, a getDomain entry in the request-function registry, and a _GENERALTRANSLATION_CUSTOM_GET_DOMAIN_ENABLED build env var) but never wired to any runtime consumer — no getDomain() request helper exists and nothing reads the env var. Removes the stub module, the ./internal/_getDomain export, the config prop/registry entries, and the dead env var. getLocale/getRegion are unchanged.

  • #1439 d6ffb70 Thanks @ErnestM1234! - Remove the deprecated SSG and experimental-locale-resolution code paths from gt-next.

    Drops the long-deprecated, runtime-dead config surface: experimentalEnableSSG, experimentalLocaleResolution/experimentalLocaleResolutionParam, the static request functions (STATIC_REQUEST_FUNCTIONS/getStatic* and their non-existent internal/static/* aliases), and disableSSGWarnings/getStatic*Path doc props. Removes plugin/checks/ssgChecks.ts, the experimental branch of cacheComponentsChecks, the related error/warning builders, and the corresponding build-time env vars (_GENERALTRANSLATION_ENABLE_SSG, _GENERALTRANSLATION_EXPERIMENTAL_LOCALE_RESOLUTION[_PARAM], _GENERALTRANSLATION_STATIC_GET_*_ENABLED) — none of which were read at runtime. The live cacheComponents checks and noLocalesCouldBeDeterminedWarning are retained.

  • #1439 195f009 Thanks @ErnestM1234! - fix: make singleton not-initialized errors consistent and descriptive, and stop error paths from masking the original failure when I18nConfig is also uninitialized

  • Updated dependencies [463a8db, 37e0080, 5bfd0a7, 8870496, 7a9dbe3, 1212135, 04f419d, bd52e5e, b72c30b, 72e9e16, 42a440f, fd22c68, bea8233, 8870496, 5736d58, 8d2e84e, 04b5064, 4335432, 04c285c, 947fe0c, 5adeede, 55c77ea, e026c42, 328795b, 1f53e42, b3bb391, d48604e, 88f3a2e, e12fb17, 44bc998, 5752fe8, 7744c55, b7d44dc, 9561761, 72c6a85, 3d95277, 97dc7f4, c1e0a0f, 85a0c19, 693288d, 463a8db, e343775, 40db0c5, 8a2f7ee, c5364f9, 2e85ebd, 2c46baf, d5cf2d3, 9e78cf0, 4986567, 795edc8, d863bcf, 11ecf87, 03bae6d, 5d42608, 9804aa4, 338e5e8, 8834c51, 2ca78ec, 195f009]:

    • gt-i18n@1.0.0
    • @generaltranslation/react-core@11.0.0
    • gt-react@11.0.0
    • generaltranslation@9.0.0
    • @generaltranslation/compiler@1.3.25
    • @generaltranslation/format@0.1.2
    • @generaltranslation/supported-locales@2.1.2