RFC: Host locale subscription - #526
Open
kalininilya wants to merge 2 commits into
Open
Conversation
Products receive the language the host presents its interface in, as a BCP 47 tag pushed on subscribe and on every change. Wire ids 194-197. LocaleHost joins the required Platform set.
This was referenced Aug 27, 2026
Swift and Kotlin bridges default currentLocale() to the system language, so an existing host keeps compiling without implementing it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
RFC + protocol implementation for a host locale subscription.
locale.subscribe()pushes the language the host presents its interface in, as a BCP 47 tag, on subscribe and on every change. A product renders in that language instead of inferring one fromnavigator.language, which reports the operating system's preference and is wrong whenever the user picked a different language inside the host.The RFC and the crate change travel together because
check-rfc.ymlfails any PR touchingdocs/rfcs/**that does not also changerust/crates/truapi/.Shape
Wire ids 194–197.
LocaleHostjoins the requiredPlatformset alongsideThemeHost, so a host serves a real value rather than reporting the method unsupported.The tag is an open string rather than an enum of shipped languages: a host adds a language without a protocol change, and a product that ships no catalog entry for the tag it receives picks its own fallback.
Verified
cargo test --workspace— 1052 passed, 0 failedcargo +nightly fmt --checkandcargo clippy --workspace --all-targets --all-features -- -D warningsclean./scripts/codegen.shregenerated the client, dispatcher, wire table and WASM bridge; golden diffs are locale-onlyjs/packages/truapi:npm run buildandnpm test— 255 passedTracking issue follows.