aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub/src/meshbay_hub/static/app.js
diff options
context:
space:
mode:
Diffstat (limited to 'packages/meshbay-hub/src/meshbay_hub/static/app.js')
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/app.js21
1 files changed, 17 insertions, 4 deletions
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/app.js b/packages/meshbay-hub/src/meshbay_hub/static/app.js
index 9f925c3..c2858f4 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/app.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/app.js
@@ -245,9 +245,7 @@ function Nav({ user, theme, onThemeChange, onLogout, onMenuToggle, unreadCount,
<div class="nav-right">
${user && html`<${TransferWidget} />`}
${platform.capabilities.tray && html`
- <button class="nav-tray" onClick=${() => platform.minimizeToTray({
- show: t('tray.show'), quit: t('tray.quit'),
- start_node: t('tray.start_node'), stop_node: t('tray.stop_node') })}
+ <button class="nav-tray" onClick=${() => platform.minimizeToTray(trayLabels())}
title=${t('nav.minimize_tray')} aria-label=${t('nav.minimize_tray')}>
<${Icon} name="tray" />
</button>
@@ -929,10 +927,25 @@ function App() {
// ── Boot ─────────────────────────────────────────────────────────────────────
+// The tray menu's four strings. The main process has no i18n (see
+// packages/meshbay-client/src/main.js), so they are translated here and sent
+// over the bridge — once at boot, because the app now creates its indicator at
+// launch rather than on the first minimise, and again from the nav button.
+const trayLabels = () => ({
+ show: t('tray.show'), quit: t('tray.quit'),
+ start_node: t('tray.start_node'), stop_node: t('tray.stop_node'),
+});
+
// Catalogues are fetched, so the first render waits for one: mounting earlier
// would paint the interface in English and then swap every string. initLocale()
// falls back to English rather than rejecting, so this cannot strand the page.
-const mount = () => render(html`<${App} />`, document.getElementById('app'));
+const mount = () => {
+ render(html`<${App} />`, document.getElementById('app'));
+ // After the catalogue, so the labels are in the right language. A no-op in a
+ // browser and on macOS. A language change reloads the page, which comes back
+ // through here, so nothing else has to watch for it.
+ platform.setTrayLabels(trayLabels()).catch(() => {});
+};
initLocale().then(mount, (err) => {
// Nothing in initLocale() is supposed to reject. If something does, an
// English interface is still an interface; an unhandled rejection here is a