Skip to content

Change language without restarting - #251

Merged
JE-Chen merged 1 commit into
mainfrom
dev
Jul 26, 2026
Merged

Change language without restarting#251
JE-Chen merged 1 commit into
mainfrom
dev

Conversation

@JE-Chen

@JE-Chen JE-Chen commented Jul 26, 2026

Copy link
Copy Markdown
Member

Changing language without restarting

Choosing a language updated the setting and then asked for a restart: not one
word on screen changed. It now relabels everything at once.

  • The menus and the toolbar are rebuilt. They are built at startup, so
    rebuilding is both the simplest and the most complete way to relabel them.
  • Panels relabel themselves. The problems, test, TODO and outline panels hold
    state -- diagnostics, test results, a scan -- so each has a retranslate
    rather than being torn down and rebuilt.
  • Tab and dock titles are looked back up. The old text is matched against the
    old dictionary and replaced with the new language's version of that key, which
    leaves file and branch names untouched.

That lookup has to be told which keys to consider. In English "Editor" is a tab
name, a dock title and an untranslated menu identifier all at once, and an
unguided lookup lands on the untranslated one -- so the title comes back as
"Editor" and the change reads as simply not working. Only a named set of title
keys is considered, with a test that every one of them exists.

A thread outliving its widget, again

Rebuilding the toolbar has to wait for the outgoing one's git branch scan first:
that scan finishes by filling a combo box which is about to be deleted, and Qt
aborts the process when it lands. Naming the threads in an earlier change is
what made this a one-run diagnosis -- the abort message said
Toolbar_GitBranchWorker outright.

Two test fixtures build a toolbar on a bare window, which never runs the real
window's close handler, so they wait for the scan themselves.

Quieting the embedded browser

QtWebEngine embeds a whole Chromium which writes its own messages to standard
error, such as mf_video_encoder_util.cc: Set output type failed when it probes
a hardware video encoder that will not take the settings. Chromium falls back on
its own and nothing is broken, but this editor pipes standard error into its
output pane, so it lands in front of the user. Chromium's log level is set to
fatal-only before QtWebEngine initialises, and a level the user set is left
alone.

Note that the flag is verified as being set correctly and not overriding an
existing choice; whether that particular line disappears has not been reproduced
here, since it needs a running browser tab.

Verification

ruff check . clean. 1798 tests pass on 3.11 and on 3.10.

Choosing a language updated the setting and then asked for a restart: not one
word on screen changed. It now relabels everything at once.

The menus and the toolbar are built at startup, so they are rebuilt. Panels hold
state -- diagnostics, test results -- so each relabels itself instead. Tab and
dock titles are moved by looking the old text back up in the old dictionary,
which leaves file and branch names alone.

That lookup has to be told which keys to consider. In English "Editor" is a tab
name, a dock title and an untranslated menu identifier all at once, and an
unguided lookup lands on the untranslated one -- which reads as the language
change simply not working.

Rebuilding the toolbar waits for the outgoing one'"'"'s git scan first: that scan
finishes by filling a combo box which is about to be deleted, and Qt aborts the
process when it lands.
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 62 complexity · 0 duplication

Metric Results
Complexity 62
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@sonarqubecloud

Copy link
Copy Markdown

@JE-Chen
JE-Chen merged commit 56f3160 into main Jul 26, 2026
9 checks passed
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