Полностью поддерживает английский язык

This commit is contained in:
AidarKC
2026-11-10 14:02:34 +03:00
parent 405b9a91a7
commit 9c30b33b39
71 changed files with 2658 additions and 1445 deletions
+21 -21
View File
@@ -1,4 +1,4 @@
import { initI18n, onLanguageChange } from './i18n/index.js';
import { initI18n, onLanguageChange, t } from './i18n/index.js';
import {
navigate,
getRoute,
@@ -342,7 +342,7 @@ setClientErrorSentNotifier((payload) => {
if (!isDeveloperToolsEnabled()) return;
const login = String(state.session.login || 'guest').trim();
const isoTs = new Date(Number(payload?.clientTs || Date.now())).toISOString();
showToast(`Ошибка отправлена на сервер · ${login} · ${isoTs}`);
showToast(t('remaining.app.error_sent_to_server_login_time', { login, time: isoTs }));
});
window.__SHINE_SEND_CLIENT_ERROR_TO_SERVER__ = (payload) => authService.reportClientError(payload);
window.__SHINE_SEND_CLIENT_ERROR__ = window.__SHINE_SEND_CLIENT_ERROR_TO_SERVER__;
@@ -734,7 +734,7 @@ async function tryLockPortraitOrientation() {
}
async function notifyHiddenIncomingMessage(fromLogin, toLogin, unreadCount, messageKey, notificationVersionMs) {
const title = `Сообщение от ${fromLogin}`;
const title = t('remaining.app.message_from_login', { login: fromLogin });
const body = dmUnreadLabel(unreadCount);
try {
const registration = await navigator.serviceWorker?.getRegistration?.();
@@ -781,7 +781,7 @@ function ensureConnectionRetryBannerEl() {
const el = document.createElement('div');
el.id = 'connection-retry-banner';
el.className = 'connection-retry-banner is-connecting';
el.textContent = 'Соединяюсь…';
el.textContent = t('remaining.app.connecting');
el.addEventListener('click', () => {
void triggerImmediateConnectionRetry();
});
@@ -835,17 +835,17 @@ function refreshConnectionUi() {
}
if (state === 'connecting') {
bannerEl.textContent = 'Соединяюсь… Нажмите, чтобы попробовать сразу';
bannerEl.textContent = t('remaining.app.connecting_tap_to_retry_now');
return;
}
if (state === 'disconnected') {
const secs = getConnectionRetrySecondsLeft();
bannerEl.textContent = `Нет соединения. Повтор через ${secs}с. Нажмите для попытки сейчас`;
bannerEl.textContent = t('remaining.app.disconnected_retrying_in_secs_s_tap_to_retry_now', { secs });
return;
}
bannerEl.textContent = 'Проблема с соединением. Нажмите для повтора';
bannerEl.textContent = t('remaining.app.connection_problem_tap_to_retry');
}
function finishInitialConnectionSplash() {
@@ -870,7 +870,7 @@ function startConnectionCountdown() {
const secs = getConnectionRetrySecondsLeft();
if (secs <= 0 && !connectionCheckInFlight) {
connectionStatusText = '';
setConnectionStatus('connecting', 'Соединяюсь…');
setConnectionStatus('connecting', t('remaining.app.connecting'));
void checkConnectionHealth();
return;
}
@@ -970,15 +970,15 @@ async function ensurePushTargetProfile(payload = {}, { action = '' } = {}) {
const currentLogin = String(state.session.login || '').trim();
if (!targetLogin || targetLogin.toLowerCase() === currentLogin.toLowerCase()) return true;
if (!savedProfileExists(targetLogin)) {
showToast(`Уведомление пришло профилю ${targetLogin}, который не сохранён на этом устройстве.`, { kind: 'info' });
showToast(t('remaining.app.a_notification_was_sent_to_profile_login_which_is_not_sav', { login: targetLogin }), { kind: 'info' });
return false;
}
const kind = String(payload?.kind || '').trim();
const question = kind === 'incoming_call'
? `Входящий звонок для профиля «${targetLogin}». Переключиться на этот профиль?`
: `Это сообщение пришло профилю «${targetLogin}». Переключиться, чтобы открыть его?`;
const confirmed = await confirmDialog({ title: 'Переключить профиль?', text: question, confirmLabel: 'Переключить' });
? t('remaining.app.incoming_call_for_profile_login_switch_to_this_profile', { login: targetLogin })
: t('remaining.app.this_message_was_sent_to_profile_login_switch_profiles_to', { login: targetLogin });
const confirmed = await confirmDialog({ title: t('remaining.app.switch_profile'), text: question, confirmLabel: t('remaining.app.switch') });
if (!confirmed) return false;
try {
@@ -991,7 +991,7 @@ async function ensurePushTargetProfile(payload = {}, { action = '' } = {}) {
}
return false;
} catch (error) {
showToast(toUserMessage(error, 'Не удалось переключить профиль.'), { kind: 'error' });
showToast(toUserMessage(error, t('remaining.app.could_not_switch_profile')), { kind: 'error' });
return false;
}
}
@@ -1059,7 +1059,7 @@ function setConnectionStatus(nextState, text = '') {
async function triggerImmediateConnectionRetry() {
if (connectionCheckInFlight) return;
connectionNextRetryAtMs = Date.now() + CONNECTION_CHECK_INTERVAL_MS;
setConnectionStatus('connecting', 'Соединяюсь…');
setConnectionStatus('connecting', t('remaining.app.connecting'));
await checkConnectionHealth();
}
@@ -1308,7 +1308,7 @@ async function ensureSessionAfterWsReconnect() {
} catch (error) {
if (isSessionInvalidError(error)) {
await terminateCurrentSession({
infoMessage: 'Ваша сессия устарела. Авторизируйтесь заново.',
infoMessage: t('remaining.app.your_session_has_expired_please_sign_in_again'),
});
return false;
}
@@ -1329,7 +1329,7 @@ function showGlobalErrorAlert(title, details = {}) {
const now = Date.now();
if (now - lastCrashNoticeAt < 30000) return;
lastCrashNoticeAt = now;
showToast('Что-то пошло не так. Сведения об ошибке уже отправлены разработчикам – попробуйте ещё раз.', { kind: 'error' });
showToast(t('remaining.app.something_went_wrong_error_details_were_sent_to_the_devel'), { kind: 'error' });
return;
}
const lines = [title];
@@ -1435,16 +1435,16 @@ function renderPageFailureFallback(pageId, error) {
card.className = 'card stack channels-status';
const title = document.createElement('strong');
title.textContent = 'Не удалось отрисовать экран';
title.textContent = t('remaining.app.could_not_display_this_screen');
const details = document.createElement('p');
details.className = 'meta-muted';
details.textContent = `Экран: ${pageId || 'неизвестно'}. Попробуйте повторить.`;
details.textContent = t('remaining.app.screen_render', { page: pageId || t('remaining.app.unknown') });
const retry = document.createElement('button');
retry.type = 'button';
retry.className = 'primary-btn';
retry.textContent = 'Повторить';
retry.textContent = t('remaining.app.retry');
retry.addEventListener('click', () => renderApp());
card.append(title, details, retry);
@@ -1613,7 +1613,7 @@ async function tryAutoLogin() {
return;
}
await terminateCurrentSession({
infoMessage: 'Сессия на этом устройстве уже завершена. Выполните вход заново.',
infoMessage: t('remaining.app.this_session_has_ended_on_this_device_please_sign_in_agai'),
});
}
}
@@ -1741,7 +1741,7 @@ async function init() {
localStorage.setItem('shine-ui-last-push-at-v1', String(now));
localStorage.setItem('shine-ui-last-push-payload-v1', JSON.stringify(payload || {}));
if (kind === 'test_push') {
localStorage.setItem('shine-ui-last-test-push-status-v1', 'доставлен');
localStorage.setItem('shine-ui-last-test-push-status-v1', 'delivered');
localStorage.setItem('shine-ui-last-test-push-at-v1', String(now));
}
} catch {