Skip to content

Read the option tab titles when the sheet opens, not when it is built - #150

Merged
xroche merged 3 commits into
masterfrom
tab-titles-lang
Aug 24, 2026
Merged

Read the option tab titles when the sheet opens, not when it is built#150
xroche merged 3 commits into
masterfrom
tab-titles-lang

Conversation

@xroche

@xroche xroche commented Aug 24, 2026

Copy link
Copy Markdown
Owner

On a first run the option pages are constructed with the main frame, before the language dialog. LANG_T(-1) is 0 then, so each page keeps its .rc caption. Every other string on a page is set at display time, so the sheet came up with translated content under English tabs, and only a restart fixed it.

Each page now exposes SetLangTitle(), the block its constructor already ran, and CMainTab::DoModal() calls all eleven before the base creates the sheet. That order matters: comctl32 sizes the tab strip from the captions in effect at creation, so relabelling afterwards loses a row. An earlier attempt in this branch relabelled afterwards, and a Romanian walk came back with six tabs of eleven and five pages unreachable.

Verified against this build with the walk's --language. Romanian lays out three rows carrying all eleven tabs, French two rows, and the English walk is unchanged. Romanian also clips a long static label on the Limits page, which predates this and is left alone.

English keeps its .rc caption, because the catalog would otherwise retitle one tab MIME Types over MIME types for every English user.

Closes #149.

xroche and others added 3 commits August 24, 2026 21:34
The option pages are constructed with the main frame, which on a first run
happens before the language dialog, so LANG_T(-1) is still 0 and the
PSP_USETITLE branch never runs. Every other string on a page is set at
display time, so the sheet came up with translated content under English
tabs, and only a restart fixed it.

CMainTab::DoModal() now re-reads the eleven titles first, which covers all
three call sites. SetWindowText() copies into the page's own m_strCaption,
so the hash-table string a language change frees is not stashed (#56).

Signed-off-by: Xavier Roche <xroche@gmail.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Xavier Roche <roche@httrack.com>
Setting each page's caption ahead of CPropertySheet::DoModal() stopped the
sheet from opening at all: a French walk reached the main window, clicked
Define options, and no sheet appeared. CPropertyPage::SetWindowText() is not
usable on a page whose window does not exist yet.

The tab control owns the text once the sheet is up, so OnInitDialog() sets it
there instead. Pages are matched with GetPageIndex() rather than by tab order,
so DefineDefaultProxy(), which leaves all but one page out, still works.

Signed-off-by: Xavier Roche <xroche@gmail.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Xavier Roche <roche@httrack.com>
Relabelling the tab control from OnInitDialog came too late. comctl32 sizes
the strip from the captions in effect when the sheet is created, which on a
first run are the English .rc ones, so longer labels wrapped into a row the
sheet had no room for. A Romanian walk showed six tabs of eleven, with five
pages unreachable: worse than the English titles it replaced.

Each page now exposes SetLangTitle(), which is the block its constructor
already ran, and CMainTab::DoModal() calls all eleven before the base creates
the sheet. The constructor calls the same method, so the two copies that used
to drift are one.

English still keeps its .rc caption, as before: the catalog would otherwise
retitle one tab MIME Types over MIME types for every English user.

Signed-off-by: Xavier Roche <xroche@gmail.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Xavier Roche <roche@httrack.com>
@xroche
xroche marked this pull request as ready for review August 24, 2026 22:33
@xroche
xroche merged commit c5f5b1c into master Aug 24, 2026
6 checks passed
@xroche
xroche deleted the tab-titles-lang branch August 24, 2026 22:33
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.

Option tab titles keep the .rc caption until a restart

1 participant