feat: full i18n support - all pages use Lang.t() for zh/en

This commit is contained in:
2026-07-27 20:31:41 +08:00
parent 860bc015e8
commit de58a1c42f
10 changed files with 578 additions and 282 deletions
+2 -2
View File
@@ -49,7 +49,7 @@ const Sidebar = {
this._gameListEl.innerHTML = '';
if (!Array.isArray(games) || games.length === 0) {
this._gameListEl.innerHTML = '<div style="padding:8px 12px;color:var(--text-tertiary);font-size:12px;">暂无可用的游戏插件</div>';
this._gameListEl.innerHTML = '<div style="padding:8px 12px;color:var(--text-tertiary);font-size:12px;">' + Lang.t('noGamePlugins') + '</div>';
return;
}
@@ -77,7 +77,7 @@ const Sidebar = {
return;
}
}
this._gameLabelEl.textContent = '选择游戏';
this._gameLabelEl.textContent = Lang.t('selectGame');
},
async _selectGame(gameId) {
+4 -4
View File
@@ -8,15 +8,15 @@ const Topbar = {
if (!WS.connected) {
WS._reconnectDelay = 500;
WS._connect();
Toast.show('正在重连...', 'info', 1500);
Toast.show(Lang.t('loading'), 'info', 1500);
}
});
WS.on('status', (status) => {
this._statusEl.className = `status-indicator ${status}`;
this._statusEl.querySelector('.status-text').textContent =
status === 'connected' ? '已连接' :
status === 'error' ? '连接错误' : '未连接';
status === 'connected' ? Lang.t('connected') :
status === 'error' ? Lang.t('connectionError') : Lang.t('disconnected');
});
setInterval(() => this._refreshStatus(), 5000);
@@ -28,7 +28,7 @@ const Topbar = {
const wsStatus = status.ws_clients > 0 ? 'connected' : 'disconnected';
this._statusEl.className = `status-indicator ${wsStatus}`;
this._statusEl.querySelector('.status-text').textContent =
wsStatus === 'connected' ? `已连接 (${status.ws_clients})` : '未连接';
wsStatus === 'connected' ? `${Lang.t('connected')} (${status.ws_clients})` : Lang.t('disconnected');
} catch (e) { console.error(e); }
}
};