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

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
+15 -14
View File
@@ -1,3 +1,4 @@
import { t } from '../i18n/index.js';
import {
acceptIncomingCall,
declineIncomingCall,
@@ -82,10 +83,10 @@ function getSnapshotElapsedMs(snapshot) {
}
function buildBarText(snapshot) {
const peer = String(snapshot?.peerLogin || '').trim() || 'пользователь';
const peer = String(snapshot?.peerLogin || '').trim() || t('remaining.call_ui.user');
const elapsed = formatElapsedMs(getSnapshotElapsedMs(snapshot));
const kind = String(snapshot?.titleText || 'Звонок').trim() || 'Звонок';
return `${kind} с ${peer} · ${elapsed}`;
const kind = String(snapshot?.titleText || t('remaining.call_ui.call')).trim() || t('remaining.call_ui.call');
return t('remaining.call_ui.call_with', { kind, peer, elapsed });
}
async function loadAvatarSnapshot(login) {
@@ -116,7 +117,7 @@ function renderPeerAvatar(login, avatar = null) {
avatar,
size: 'xl',
className: 'call-peer-avatar',
title: login ? `Профиль ${login}` : 'Профиль собеседника',
title: login ? t('remaining.call_ui.profile_of', { login }) : t('remaining.call_ui.other_user_s_profile'),
});
if (!hasAvatar) {
avatarEl.classList.add('call-peer-avatar--empty');
@@ -194,7 +195,7 @@ function setButtonIcon(button, iconName, label) {
function updateMuteButtons(muted) {
const iconName = muted ? 'mic-off' : 'mic-on';
const label = muted ? 'Включить микрофон' : 'Выключить микрофон';
const label = muted ? t('remaining.call_ui.unmute_microphone') : t('remaining.call_ui.mute_microphone');
setButtonIcon(muteBtn, iconName, label);
setButtonIcon(barMuteBtn, iconName, label);
if (muteBtn) muteBtn.dataset.muted = muted ? '1' : '0';
@@ -203,14 +204,14 @@ function updateMuteButtons(muted) {
function updateSpeakerButtons(enabled) {
const iconName = enabled ? 'speaker-on' : 'speaker-off';
const label = enabled ? 'Выключить громкую связь' : 'Включить громкую связь';
const label = enabled ? t('remaining.call_ui.turn_off_speaker') : t('remaining.call_ui.turn_on_speaker');
setButtonIcon(speakerBtn, iconName, label);
setButtonIcon(barSpeakerBtn, iconName, label);
}
function updateCameraButtons(enabled) {
const iconName = enabled ? 'camera-on' : 'camera-off';
const label = enabled ? 'Выключить камеру' : 'Включить камеру';
const label = enabled ? t('remaining.call_ui.turn_off_camera') : t('remaining.call_ui.turn_on_camera');
setButtonIcon(cameraBtn, iconName, label);
setButtonIcon(barCameraBtn, iconName, label);
if (cameraBtn) cameraBtn.dataset.enabled = enabled ? '1' : '0';
@@ -380,7 +381,7 @@ function ensureUi() {
minimizeBtn = document.createElement('button');
minimizeBtn.type = 'button';
minimizeBtn.className = 'call-icon-btn call-icon-btn--secondary call-overlay-minimize-btn';
setButtonIcon(minimizeBtn, 'minimize', 'Свернуть звонок');
setButtonIcon(minimizeBtn, 'minimize', t('remaining.call_ui.minimize_call'));
minimizeBtn.addEventListener('click', (event) => {
stopEvent(event);
if (!currentSnapshot) return;
@@ -455,7 +456,7 @@ function ensureUi() {
acceptBtn = document.createElement('button');
acceptBtn.type = 'button';
acceptBtn.className = 'call-accept-btn';
acceptBtn.textContent = 'Ответить';
acceptBtn.textContent = t('remaining.call_ui.answer');
acceptBtn.addEventListener('click', async () => {
await acceptIncomingCall();
});
@@ -463,7 +464,7 @@ function ensureUi() {
declineBtn = document.createElement('button');
declineBtn.type = 'button';
declineBtn.className = 'destructive-btn call-decline-btn';
declineBtn.textContent = 'Отклонить';
declineBtn.textContent = t('remaining.call_ui.decline');
declineBtn.addEventListener('click', async () => {
await declineIncomingCall();
});
@@ -471,7 +472,7 @@ function ensureUi() {
hangupBtn = document.createElement('button');
hangupBtn.type = 'button';
hangupBtn.className = 'call-icon-btn call-icon-btn--danger';
setButtonIcon(hangupBtn, 'hangup', 'Положить трубку');
setButtonIcon(hangupBtn, 'hangup', t('remaining.call_ui.hang_up'));
hangupBtn.addEventListener('click', handleEndCallClick);
incomingActionsEl.append(acceptBtn, declineBtn);
@@ -489,8 +490,8 @@ function applyExpandedState(snapshot) {
titleEl.textContent = '';
statusEl.textContent = '';
peerLoginEl.textContent = snapshot.peerLogin || 'пользователь';
kindEl.textContent = snapshot.titleText || 'Звонок';
peerLoginEl.textContent = snapshot.peerLogin || t('remaining.call_ui.user');
kindEl.textContent = snapshot.titleText || t('remaining.call_ui.call');
topStatusEl.textContent = snapshot.statusText || '';
updatePeerAvatar(snapshot.peerLogin || '');
@@ -554,7 +555,7 @@ function applyMinimizedState(snapshot) {
const canEnd = !incomingStage && snapshot.canHangup;
barHangupBtn.hidden = !canEnd;
barHangupBtn.disabled = !canEnd;
setButtonIcon(barHangupBtn, 'hangup', 'Положить трубку');
setButtonIcon(barHangupBtn, 'hangup', t('remaining.call_ui.hang_up'));
barActionsEl.hidden = incomingStage || (!snapshot.canToggleSpeaker && !snapshot.canMute && !snapshot.canToggleCamera && !canEnd);
}