[glm-grade=B+] feat(i18n): complete card/filter/action translation keys for 31 languages

Full language display names + RTL set (ar/fa/ur) on /i18n/languages;
card.internet/auth/tailscale/dashca, status pills, filter bar and
batch-operation strings added to every language dictionary. Frontend:
English now loads the server dictionary too (keys are semantic ids,
not fallback copy), failed loads keep existing DOM text instead of
exposing raw keys, isLoaded() gate for pre-load renders. Rebuilt
status/dist. Tests: i18n-cards 9/9, full suite 1837/1837.
This commit is contained in:
Krystie
2026-08-15 00:01:17 -07:00
parent bd40fb1c17
commit ef685e515e
11 changed files with 495 additions and 167 deletions
+19 -3
View File
@@ -1,6 +1,12 @@
// ========== GRID & STATUS HELPERS ==========
(function () {
function statusLabel(up) {
const i18n = window.DCI18n;
if (!i18n || !i18n.isLoaded()) return up ? 'ON' : 'OFF';
return i18n.t(up ? 'card.status.on' : 'card.status.off');
}
/* Enhanced status helpers with response time tracking */
function setQuick(id, up, responseTime = null) {
const dot = document.getElementById(id + '-dot');
@@ -14,7 +20,7 @@
}
if (pill) {
pill.textContent = up ? 'ON' : 'OFF';
pill.textContent = statusLabel(up);
pill.classList.toggle('on', up);
pill.classList.toggle('off', !up);
}
@@ -172,7 +178,10 @@
row.appendChild(el('span', 'spacer'));
const pill = el('span', 'badge off', 'OFF'); pill.id = 'badge-' + s.id; row.appendChild(pill);
const pill = el('span', 'badge off', 'OFF');
pill.id = 'badge-' + s.id;
pill.setAttribute('data-i18n-live-status', 'binary');
row.appendChild(pill);
// Update available badge (hidden by default, shown when update detected)
const updateBadge = el('span', 'update-available-badge', 'UPDATE');
@@ -301,6 +310,7 @@
}
const btn = el('button', null, 'Open');
btn.setAttribute('data-i18n', 'action.open');
btn.onclick = () => window.open(serviceUrl(s.id), '_blank', 'noopener');
btnRow.appendChild(btn);
card.appendChild(btnRow);
@@ -309,6 +319,12 @@
root.appendChild(card);
}
// Cards can be created after the initial language pass. Translate their
// initial live state and controls immediately instead of waiting for poll.
if (window.DCI18n && window.DCI18n.isLoaded()) {
window.DCI18n.applyTranslations();
}
requestAnimationFrame(() => {
root.querySelectorAll('.card').forEach(card => card.classList.add('loaded'));
});
@@ -332,7 +348,7 @@
}
if (pill) {
pill.textContent = up ? 'ON' : 'OFF';
pill.textContent = statusLabel(up);
pill.classList.toggle('on', up);
pill.classList.toggle('off', !up);
}