Skip to content

refactor(i18n)!: consume the shared runtime from @stream-io/i18n - #3284

Open
oliverlaz wants to merge 2 commits into
release-v15from
feat/i18n-from-toolkit
Open

refactor(i18n)!: consume the shared runtime from @stream-io/i18n#3284
oliverlaz wants to merge 2 commits into
release-v15from
feat/i18n-from-toolkit

Conversation

@oliverlaz

@oliverlaz oliverlaz commented Sep 10, 2026

Copy link
Copy Markdown
Member

Tracked in REACT-1172

Retargets every stream-chat/i18n import to @stream-io/i18n, where the shared runtime now lives. The API is unchanged β€” only the specifier moves.

BREAKING β€” requires @stream-io/i18n and stream-chat@^10.0.0-rc.10.

⚠️ CI will fail the install step until the dependencies publish

@stream-io/i18n@1.0.0 and stream-chat@10.0.0-rc.10 are not on npm yet, so yarn.lock cannot be regenerated and is deliberately left untouched in this PR. Everything else is reviewable now. Locally this was verified against packed tarballs of both.

What changed

  • Every stream-chat/i18n import β†’ @stream-io/i18n (5 files plus the codegen script).
  • languageNameDefaults / LanguageNameCatalog now come from stream-chat's root barrel β€” they enumerate the languages the Chat API can auto-translate a message into, so they stayed with Chat.
  • TranslationContext and useStreami18n are built on the shared bindings in @stream-io/i18n/react, so this SDK and React Native stop carrying two copies of the same context plumbing and store subscription.

What stays this SDK's own: the catalog-typed t, the notification translation topic, and supplying a context default rather than throwing β€” which is what lets a primitive render outside <Chat> (React Native throws instead, which is why the shared factory takes that as an option).

@stream-io/i18n is a regular dependency, not a peer: an integrator never imports it β€” they import the Streami18n this package subclasses and re-exports.

Also fixes: yarn types checked nothing

It ran tsc with no --project, so it picked up the root solution file ("files": []) and exited 0 even with a deliberate type error in src/. It is now tsc -p tsconfig.lib.json --noEmit, verified to fail on a planted error, and added to CI β€” which previously typechecked only the build scripts, so a library type error could reach master. CLAUDE.md / AGENTS.md updated accordingly (they documented the trap rather than fixing it).

Verification

yarn types (the real one), yarn lint, and 2,769 tests all pass against locally-linked builds of @stream-io/i18n and stream-chat. Also verified end-to-end in the Vite example: switching language at runtime updates copy, plurals, placeholders, aria-labels and dates β€” Tue, 2 Aug β†’ Di., 2. Aug., 08/02/2022 β†’ 02.08.2022 β€” with no reload.

Merge order

After js-toolkit#51 and stream-chat-js#1861, then rerun yarn install to commit a real lockfile.

BREAKING CHANGE: requires `@stream-io/i18n` and `stream-chat@^10.0.0-rc.10`.

Retargets every `stream-chat/i18n` import to `@stream-io/i18n`, which is where
the shared runtime now lives. The API is unchanged; only the specifier moves.

`languageNameDefaults` / `LanguageNameCatalog` come from `stream-chat`'s root
barrel instead β€” they enumerate the languages the Chat API can auto-translate a
message into, so they stayed with Chat rather than moving to the generic package.

`TranslationContext` and `useStreami18n` are now built on the shared bindings in
`@stream-io/i18n/react`, so this SDK and the React Native one no longer carry two
copies of the same context plumbing and store subscription. What stays here is
what is genuinely this SDK's: the catalog-typed `t`, the notification
translation topic, and supplying a context *default* rather than throwing, which
is what lets a primitive render outside `<Chat>`.

`@stream-io/i18n` is a regular dependency, not a peer: an integrator never
imports it β€” they import the `Streami18n` this package subclasses and re-exports.

Also fixes `yarn types`, which silently checked nothing. It ran `tsc` with no
`--project`, picking up the root solution file (`"files": []`), and exited 0 even
with a deliberate error in `src/`. It is now `tsc -p tsconfig.lib.json --noEmit`
and is wired into CI, which previously typechecked only the build scripts.
@coderabbitai

coderabbitai Bot commented Sep 10, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

βš™οΈ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: d29dd27a-11fc-4276-b439-516a8912ea42

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • πŸ” Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❀️ Share

Comment @coderabbitai help to get the list of available commands.

BREAKING CHANGE: adds `@stream-io/state-store` as a dependency.

`stream-chat` no longer re-exports `StateStore`, so the 22 modules that imported
it from there now take it from the package that defines it. No behaviour change β€”
the store instances are the same objects, only the import specifier moves.

A single shared declaration matters here: TypeScript compares classes with
`protected` members nominally, so two copies would not be assignable to one
another and `useStateStore` would stop typechecking against stores handed over by
`stream-chat` or `@stream-io/i18n`.
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.

2 participants