enhancement
major
minor
major
minor
major
#29674
TL Views: after a page load, app-bar command labels appear in the browser's language instead of the user's ("Record" in a German session)
Problem
In a session whose user language is German, with the browser locale en-US, the app bar's commands intermittently read "Record" / "New ticket" while the rest of the page is German ("Aufzeichnen" / "Neues Ticket" expected). Their labels are inline <en>/`<de>` on <generic-command>`s in the `<app-bar> of the TL Development app, snapshot build 42.
Reproduced:
- Log in (the login reloads the page): the labels are German.
- Navigate with a full page load (goto /view/projects or F5): the labels are English.
Explicitly choosing "Deutsch" in the user menu cures it for a while. Everything outside the app bar (sidebar, panels, tables) stays German throughout.
Cause
Leaving a page (reload or navigation) reports the unload to the server (windowClosed with unload). ReactWindowRegistry.windowUnloaded then detaches the window's control tree on the reporting request, which has no subsession of the window installed. Detach listeners run there without the user's context: a dashboard removes its edit/`done` commands from the shared command scope, the app bar rebuilds its toolbar, and every button resolves its label in the fallback locale (the JVM default, English). Navigating to a page without that dashboard never rebuilds the bar again, and later reloads re-render the stored English state. The same gap affects closing a side window (windowClosed) and sweeping unloaded windows (sweepUnloadedWindows, which ran in the calling window's subsession), including TLContext.isAnonymous() answering true inside detach/close listeners.
Expected
Every label is resolved in the user's language, whichever request renders it.
Lösung
ReactWindowRegistry runs every operation on a window's control tree that happens outside that window's own requests (unload detach, close, sweep of unloaded windows) in the window's own subsession, taken from the session context by the window name, and restores the caller's subsession afterwards. Detach and close listeners thus see the window's user and locale exactly as during rendering and commands.