Skip to content

gt-i18n@1.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.

  • #1820 1f53e42 Thanks @bgub! - Clean up the gt-i18n public API surface by removing dead subpaths, internal exports, and unused types.

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

  • #1439 c1e0a0f Thanks @ErnestM1234! - Remove deprecated translation options. The context dictionary option has been removed in favor of $context, and the $_locales inline option has been removed in favor of $locale.

  • #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.

Minor Changes

  • #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.

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.

  • #1818 b72c30b Thanks @bgub! - Clean up the generaltranslation public API surface for the next major.

    Removes the unused generaltranslation/core subpath, stale endpoint types, duplicate ApiError accessors, and dead /internal exports. Moves API_VERSION to generaltranslation/internal, exports the derivation helpers from the public root, and points gt-i18n at that public entry.

  • #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 42a440f Thanks @ErnestM1234! - Gate duplicate singleton initialization warnings behind _GENERALTRANSLATION_LOG_LEVEL=DEBUG.

  • #1439 fd22c68 Thanks @ErnestM1234! - Defer the missing-projectId and missing-translation-loader warnings from I18nCache construction to the first translation loader invocation. Clients of server-rendered apps receive translations via updateTranslations() and never invoke the fallback loader, so they no longer log spurious warnings on initialization. Explicitly disabling translation loading with cacheUrl: null no longer logs at all, and explicitly setting cacheUrl to the default GT CDN URL alongside a projectId is now classified as GT remote loading.

  • #1811 bea8233 Thanks @bgub! - Statically gate dev hot-reload code paths (tracked resolver invalidation, missing-translation queue, T hot-reload fallbacks, getGT dev preload) behind process.env.NODE_ENV !== 'production' so bundlers can drop them from production builds. Behavior is unchanged: the existing runtime isDevHotReloadEnabled() check still applies in development.

  • #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 04b5064 Thanks @ErnestM1234! - Restore namespace scoping for getTranslations and server useTranslations.

  • #1439 328795b Thanks @ErnestM1234! - Store the GT services enabled flag on the i18n config singleton.

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

  • #1439 3d95277 Thanks @ErnestM1234! - Remove unused internal exports and dead utility code.

  • #1439 693288d Thanks @ErnestM1234! - Remove internal source barrel exports and update imports to reference defining files directly.

  • #1439 c5364f9 Thanks @ErnestM1234! - Slim the i18n cache event surface by replacing the generic EventEmitter base class with a single cache-miss listener and removing unused cache helper methods.

  • #1439 d863bcf Thanks @ErnestM1234! - Remove deprecated i18n cache lifecycle hooks and unused cache events.

    The cache subscription surface now only exposes translations-cache-miss, which is used for runtime translation updates. Deprecated lifecycle constructor callbacks and unused locale/dictionary cache hit/miss events have been removed.

  • #1439 11ecf87 Thanks @ErnestM1234! - Remove the unused condition-store/localeResolver module from gt-i18n/internal.

    determineSupportedLocale, resolveSupportedLocale, and createLocaleResolver were thin wrappers over getI18nConfig().<method>(). They had no consumers — callers (e.g. tanstack-start) use the I18nConfig methods directly via getI18nConfig(). Removing the module trims dead indirection from the /internal entry; the LocaleCandidates type re-export is unaffected (re-exported from its real source).

  • #1439 03bae6d Thanks @ErnestM1234! - Remove the unused validateLocales config validator from gt-i18n.

    validateLocales was defined but never called (config validation runs validateLoadTranslations, validateTranslationApi, and validateDictionary) and had no consumers anywhere. Dead code removed.

  • #1439 5d42608 Thanks @ErnestM1234! - Remove deprecated methods from gt-i18n's I18nCache.

    Dropped the long-@deprecated cache methods that duplicated I18nConfig/loader APIs: getDefaultLocale, getLocales, getCustomMapping, getGTClass, getTranslationLoader, resolveTranslationSync, getTranslations, and getTranslationResolver. None were called anywhere (consumers use getI18nConfig() / lookupTranslation / loadTranslations). Removes the methods, their now-unused imports, and the tests that covered them.

  • #1439 9804aa4 Thanks @ErnestM1234! - Remove three orphaned, never-imported files:

    • gt-tanstack-start: condition-store/WritableConditionStore.ts (an orphaned local copy; the package uses gt-i18n's writable condition store).
    • gt-react-native: utils/utils.ts (readAuthFromEnv, no consumers).
    • gt-i18n: i18n-cache/translations-manager/utils/types/translations-manager.ts (unreferenced TranslationsManagerConfig type).
  • #1439 2ca78ec Thanks @ErnestM1234! - Read Vite runtime credentials during React initialization while keeping dev API keys out of production bundles.

  • #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 [b72c30b, 72e9e16, 5adeede, d48604e, 88f3a2e, e12fb17, 5752fe8, 97dc7f4, 693288d, 2e85ebd, d5cf2d3, 4986567, 795edc8]:

    • generaltranslation@9.0.0
    • @generaltranslation/format@0.1.2
    • @generaltranslation/supported-locales@2.1.2