feat(host): add getLocaleProvider for the host's selected language - #333
Conversation
|
Hey @valentinfernandez1 @decrypto21 @TarikGul @pgherveou ! As paritytech/host-rust-core#526 has been approved and merged, could you take a look at the implementation for the Product SDK? This functionality is included in the first release for mobile apps and the Funding modality. |
|
Hi @kalininilya will take a look. There are some failing checks that you need to resolve. < Also, how urgent is this? to know whether we need to create a truapi release asap to include the pr from host-rust-core or if it can wait till it lands alongide the next release. |
valentinfernandez1
left a comment
There was a problem hiding this comment.
Looks good, blocking until truapi release and fix on the changeset are fixed
|
@valentinfernandez1 thank you for review! These changes have not yet been merged on the hosts - this is expected to happen today or tomorrow. However, as soon as you release the new version of the Product SDK, it will be possible to integrate the new subscription into GetCash (Funding modality), which is included in the scope of the first release on 4 September. |
|
Ok I will do a release on truapi first so we can integrate this change. |
Products render in the language chosen inside the host instead of inferring one from navigator.language, which reports the operating system's preference. Backed by truApi.locale.subscribe; needs a @parity/truapi release carrying the locale domain.
Co-authored-by: Valentin Fernandez <33705477+valentinfernandez1@users.noreply.github.com>
#353 landed the catalog bump on main, along with the `locale` entry in the testing fake this branch also carried — the rebase kept both copies. Drop ours and let main's stand, leaving this branch to `getLocaleProvider` alone. The changeset loses its blocker line for the same reason: the truapi release it waited on is the one already on the catalog. Claude-Session: https://claude.ai/code/session_012eRddy3YXhy5x3WzCpYYka
30e1673 to
d6ac566
Compare
📦 Bundle size impactComparing
Thresholds — 🟡 ≥10% or ≥5.0 KB · 🟠 ≥20% or ≥15.0 KB (bundled). Percentage only applies once the baseline is ≥ 10 KB. Informational — this check never blocks merge. |
Move the seven changesets for work merged to main since 0.25.0 from pending-changesets/ into .changeset/ so the release runs: locale provider (#333), individuality registration/fromPapi (#341), txExtVersion from formats (#342), candidate progress (#343), localStorage.clear removal (#345), airdrop id decode (#346), truapi 0.12.0 (#353). Bumps: host + individuality + umbrella minor, terminal and the rest patch.
Adds
getLocaleProvider, so a product renders in the language the user picked inside the host rather than inferring one fromnavigator.language— which reports the operating system's preference and is wrong whenever the two differ.subscribeLocalefires with the current locale and again on every change; the returnedHostSubscriptioncarriesunsubscribeandonInterrupt.getLocaleProviderresolves tonulloutside a host container.languageTagis a BCP 47 tag such as"en","pt-BR"or"zh-Hans". The set is open — a host adds languages without an SDK release — so a product that ships no catalog entry for the tag it receives picks its own fallback.The fake client models
localeas not-modeled, so a test that reaches for it fails loudly rather than silently returning nothing.Protocol counterpart: paritytech/host-rust-core#526.
Blocked on
A
@parity/truapirelease carrying thelocaledomain. The catalog pins^0.10.0, which predates it, so CI will not go green until that lands.Verified
pnpm --filter @parity/product-sdk-host typecheckagainst a local@parity/truapibuilt from RFC: Host locale subscription host-rust-core#526 — no locale errors. One unrelated error remains (system.info/getProductContextmissing from the fake client), which reproduces on a clean tree with the same link: it is drift between host-rust-coremainand the published 0.10.0, not this change.pnpm --filter @parity/product-sdk-host test— 20 files, 123 tests passed, including the new in-sourcelocale.tstest.