Skip to content

fix: keep the CLI UI language across launches - #149

Merged
runkids merged 1 commit into
mainfrom
fix/keep-cli-locale
Nov 23, 2026
Merged

runkids merged 1 commit into
mainfrom
fix/keep-cli-locale

Conversation

@runkids

@runkids runkids commented Nov 23, 2026

Copy link
Copy Markdown
Owner

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).

CliWebView now 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 as skillshare-app:cli-locale in the shell's own storage. Every later iframe URL then carries it as ?lang=, set with params.set so 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 posts locale-change when the user picks a language. An older CLI ignores ?lang= and never posts, so nothing changes with it.

wiki/frontend.md describes 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: 1f5af0a

  • pnpm lint, pnpm format:check, pnpm typecheck, pnpm build pass.
  • pnpm test passes: 26 files, 151 tests, including 3 new ones in locale-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 check passes (frontend at 16380 of 16384 B).
  • Not run: cargo checks and pnpm test:release, because nothing in Rust or the release scripts changed.
  • Pre-PR review (base 81c0d9e, head 1f5af0a):
    • Standards: no documented-standard violations. The judgement-call smells (a third message-listener effect like the existing ones, the inline tag regex) were left as is to match the surrounding code.
    • Spec: every #982 requirement is implemented, with no scope creep, and the message and param contract matches #981. Tests cover first mount and remount, but not the reload-to-reported-route path, which builds the URL in the same useMemo.
  • Not verified on screen. No released CLI contains #981 yet (latest is v0.30.13), so the relaunch behavior can't be shown end to end in the app until a CLI release ships it.

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]>
@runkids
runkids merged commit 43b98e7 into main Nov 23, 2026
3 checks passed
@runkids
runkids deleted the fix/keep-cli-locale branch November 23, 2026 02:48
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.

Desktop app: chosen language is lost on relaunch (falls back to system language)

2 participants