From e49fb46be7cb73bb8d996dc9d0b93aec0978fff5 Mon Sep 17 00:00:00 2001 From: Bruno Charest Date: Sun, 21 Jun 2026 00:11:24 -0400 Subject: [PATCH] =?UTF-8?q?fix:=20i18n=20live-reload=20for=20dashboard=20?= =?UTF-8?q?=E2=80=94=20tabs=20now=20respect=20language=20setting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Root cause: dashboard tabs rendered via t() template literals had no data-i18n attributes, so setLocale() _applyDOM() could not re-translate them live. User switching to English in profile saw no effect without page reload. Changes: - i18n.js: expose t/initI18n/setLocale/getLocale/tr globally (window.*) for non-module script compatibility - viewer.js: add data-i18n attributes to all 4 dashboard tabs + loading text + empty state messages (12 elements total) Verified: tabs show 'Statistics/Bookmarks/Recent/Shared' in EN mode --- frontend/js/i18n.js | 7 +++++++ frontend/js/viewer.js | 22 +++++++++++----------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/frontend/js/i18n.js b/frontend/js/i18n.js index bd85c51..8cfe1d7 100644 --- a/frontend/js/i18n.js +++ b/frontend/js/i18n.js @@ -138,6 +138,13 @@ async function _loadLocaleStrings(locale) { } } +// ── Global exports for non-module scripts (legacy app.js) ────────────────── +window.t = t; +window.tr = tr; +window.getLocale = getLocale; +window.setLocale = setLocale; +window.initI18n = initI18n; + /** Walk the DOM and update every element with a data-i18n* attribute. */ function _applyDOM() { // textContent diff --git a/frontend/js/viewer.js b/frontend/js/viewer.js index 6e88c2a..fbfdfd1 100644 --- a/frontend/js/viewer.js +++ b/frontend/js/viewer.js @@ -932,16 +932,16 @@ export function showWelcome() {
- - - -
@@ -949,7 +949,7 @@ export function showWelcome() {
-
${t('common.loading')}
+
${t('common.loading')}
@@ -959,8 +959,8 @@ export function showWelcome() {
- ${t('dashboard.no_bookmarks')} -

${t('dashboard.pin_hint')}

+ ${t('dashboard.no_bookmarks')} +

${t('dashboard.pin_hint')}

@@ -978,8 +978,8 @@ export function showWelcome() { @@ -988,8 +988,8 @@ export function showWelcome() {
- ${t('dashboard.no_shares')} -

${t('dashboard.shared_hint')}

+ ${t('dashboard.no_shares')} +

${t('dashboard.shared_hint')}

`;