Skip to content

Send the current UI language as locale on embedded flow requests - #121

Open
Thisara-Welmilla wants to merge 1 commit into
thunder-id:mainfrom
Thisara-Welmilla:resolve-locale-in-flows
Open

Thisara-Welmilla wants to merge 1 commit into
thunder-id:mainfrom
Thisara-Welmilla:resolve-locale-in-flows

Conversation

@Thisara-Welmilla

Copy link
Copy Markdown

Purpose

Makes the SDK carry the end user's current UI language with the flow, so the backend can render flow-driven notifications (email, SMS) in that language.

The SDK already knows the active language and builds every embedded flow-execute request, so it now attaches that language as a locale field on each request it sends — flow initiation, step submission, social-login callback, and invite-token validation alike. The selected language therefore travels with the flow automatically: consuming apps don't have to thread it through each call, and no requests are missed.

Approach

  • Core (@thunderid/javascript): added an optional locale field to the embedded flow request bodies (EmbeddedSignInFlowRequest, EmbeddedSignUpFlowRequest, EmbeddedRecoveryFlowRequest). It is a first-class, documented field — mirroring the language parameter of the flow meta API — rather than a magic key inside inputs.
  • React (@thunderid/react): each flow component (SignIn, SignUp, Recovery, AcceptInvite) reads the active language from useTranslation().currentLanguage and sets locale on the request it builds, inline alongside the other optional fields. No new helper or public surface beyond the typed field.
  • The server is responsible for validating the tag against its supported languages and ignoring it when unsupported, so the client sends the current language unconditionally.

Related Issues

  • N/A

Related PRs

Cross-SDK parity

  • react-router and tanstack-router reuse the react components, so they inherit this automatically.
  • node, express, and better-auth have no embedded-flow UI, so they are not applicable.
  • vue, nextjs, and nuxt build their own flow-driving components/entry points and need the same wiring as a follow-up (client components attach the framework's current language; the nextjs/nuxt server entry points resolve it from the request). Parity PRs to be raised.

Checklist

  • Followed the contribution guidelines.
  • Manual test round performed and verified.
  • Documentation provided. (Add links if there are any)
  • Tests provided. (Add links if there are any)
    • Unit Tests
    • Integration Tests
  • Breaking changes. (Fill if applicable)
    • Breaking changes section filled.
    • breaking change label added.
  • Cross-SDK parity. Exactly one of parity/prs-raised or parity/prs-not-needed added.
    • If parity/prs-raised, the port links are posted as a reply on the parity check's comment.

Security checks

  • Followed secure coding standards.
  • Confirmed that this PR doesn't commit any keys, passwords, tokens, usernames, or other secrets.

@github-actions

Copy link
Copy Markdown

🔀 Cross-SDK feature parity

Does this change need to ship in the other ThunderID SDKs too? This check stays red until one of these labels answers that:

Label What it asserts
parity/prs-raised The ports exist in every other SDK this change reaches, or are recorded as not applying there.
parity/prs-not-needed Nothing to port: a fix, refactor, docs, CI, dependency bump, release, or a change specific to this platform.

Ports (DO NOT EDIT)

  • thunder-id/ios-sdks, iOS
  • thunder-id/android-sdks, Android
  • thunder-id/flutter-sdks, Flutter

No sibling SDKs accounted for on this thread yet.

Important

Reply to this comment with this block, filled in. The boxes above tick
themselves when you post it.

- thunder-id/ios-sdks: <paste the port link here>
- thunder-id/android-sdks: <paste the port link here>
- thunder-id/flutter-sdks: <paste the port link here>

A link can be a pull request or a tracked issue, written in full or as thunder-id/ios-sdks#123.
Where the change does not reach an SDK, replace the placeholder with N/A and a short
reason, as in - thunder-id/ios-sdks: N/A, the capability has no equivalent there.

The contract is in the SDK development specification.

@coderabbitai

coderabbitai Bot commented Oct 15, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Repository: thunder-id/javascript-sdks/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1eeefd78-4ec3-4dc9-a76e-1c5a66cc37af
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

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.

1 participant