Repository navigation
fix: keep the CLI UI language across launches - #149
Merged
Merged
Conversation
The CLI UI runs in a cross-origin iframe whose localStorage WebKit does not keep between launches, so a language picked there is forgotten and the UI reopens in the system language (runkids/skillshare#982). Remember the language the CLI UI reports (locale-change message) in the shell's own storage and pass it back as ?lang= when the iframe loads, the same way the theme is carried. The CLI side shipped in runkids/skillshare#981; an older CLI UI ignores ?lang=. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
What
In the desktop app, a language picked in the CLI web UI was lost on relaunch: WebKit keeps no storage for the cross-origin iframe, so the UI reopened in the system language (runkids/skillshare#982).
CliWebViewnow listens for{ type: 'locale-change', locale }from the current iframe. It checks that the message comes from the current iframe and that the value looks like a language tag, and saves the language asskillshare-app:cli-localein the shell's own storage. Every later iframe URL then carries it as?lang=, set withparams.setso a reopened route cannot carry a stale value. This works the same way as the theme params.The CLI side shipped in runkids/skillshare#981 (merged, not yet in a release). The CLI UI reads
?lang=once, saves it, removes it from the address, and postslocale-changewhen the user picks a language. An older CLI ignores?lang=and never posts, so nothing changes with it.wiki/frontend.mddescribes the new behavior (App flow step 3 and a "Language sync" entry next to the iframe theme sync).The code is by @AlexisSerneels from the branch linked in the issue, and the commit keeps their authorship. The wiki update is mine.
Fixes runkids/skillshare#982
Verification
Reviewed HEAD:
1f5af0apnpm lint,pnpm format:check,pnpm typecheck,pnpm buildpass.pnpm testpasses: 26 files, 151 tests, including 3 new ones inlocale-sync.test.tsx. They check that there is no?lang=before a choice, that a reported language is passed on the next mount, and that reports from other windows or with malformed values are ignored.python3 scripts/ai-context.py checkpasses (frontendat 16380 of 16384 B).pnpm test:release, because nothing in Rust or the release scripts changed.81c0d9e, head1f5af0a):useMemo.