Локализация

This commit is contained in:
Халимов Рустам
2026-04-05 00:34:25 +03:00
parent f41ad0bcf8
commit 53f193970c
10 changed files with 243 additions and 133 deletions
@@ -15,6 +15,7 @@ import CallModal from '../../calls/presentation/components/CallModal';
import GroupCallModal from '../../calls/presentation/components/GroupCallModal';
import ContactsSidebar from '../../friends/presentation/components/ContactsSidebar';
import SettingsPage from '../../users/presentation/components/SettingsPage';
import UserProfile from '../../users/presentation/components/UserProfile';
export default function ChatPage() {
const {
@@ -419,10 +420,12 @@ export default function ChatPage() {
<SettingsPage />
) : (
<div className="flex-1 flex items-center justify-center">
<p className="text-zinc-500">Coming soon</p>
<p className="text-zinc-500">{t('comingSoon') || 'Coming soon'}</p>
</div>
)}
</main>
<CallModal
key={callSessionId}
isOpen={callOpen}
@@ -486,10 +489,10 @@ export default function ChatPage() {
{incomingGroupCall.chatName}
</h2>
<p className="text-emerald-400 font-medium mb-1 truncate w-full text-center">
{incomingGroupCall.callerInfo?.displayName || incomingGroupCall.callerInfo?.username || 'User'} {t('calling' as any) || 'звонит...'}
{incomingGroupCall.callerInfo?.displayName || incomingGroupCall.callerInfo?.username || 'User'} {t('isCalling' as any) || 'звонит...'}
</p>
<p className="text-zinc-400 text-sm mb-8 bg-white/5 px-3 py-1 rounded-full border border-white/5">
{t('group' as any) || 'Групповой звонок'}
{t('groupCall' as any) || 'Групповой звонок'}
</p>
<div className="flex items-center gap-8 w-full justify-center">
@@ -186,7 +186,7 @@ function ChatListItem({ chat, isActive }: ChatListItemProps) {
</p>
</div>
{chat.unreadCount > 0 && !isActive && (
<span className="ml-2 flex-shrink-0 min-w-[20px] h-5 px-1.5 rounded-full bg-primary text-black flex items-center justify-center text-[10px] font-black shadow-lg shadow-primary/20 animate-pulse">
<span className="ml-2 flex-shrink-0 min-w-[20px] h-5 px-1.5 rounded-full bg-primary text-[#0a0a0a] flex items-center justify-center text-[10px] font-black shadow-lg shadow-primary/20 animate-pulse">
{chat.unreadCount}
</span>
)}
@@ -1171,7 +1171,7 @@ export default function ChatView({ onStartCall, onStartGroupCall }: { onStartCal
if (!activeChat) return;
const NotificationStore = await import('../../../../core/application/stores/notificationStore');
NotificationStore.useNotificationStore.getState().addNotification('info', lang === 'ru' ? 'Поиск сообщения в истории...' : 'Searching message in history...');
NotificationStore.useNotificationStore.getState().addNotification('info', t('searchingHistory' as any) || 'Searching message in history...');
const chatStore = useChatStore.getState();
let found = false;
@@ -1209,7 +1209,7 @@ export default function ChatView({ onStartCall, onStartGroupCall }: { onStartCal
}
if (!found) {
NotificationStore.useNotificationStore.getState().addNotification('warning', lang === 'ru' ? 'Сообщение не найдено' : 'Message not found');
NotificationStore.useNotificationStore.getState().addNotification('warning', t('messageNotFound' as any) || 'Message not found');
}
};
@@ -236,7 +236,7 @@ export default function MessageInput({ chatId }: MessageInputProps) {
} catch (e) {
console.error('Ошибка загрузки файла:', e);
const { addNotification } = useNotificationStore.getState();
addNotification('error', t('uploadError') || 'Ошибка загрузки файла');
addNotification('error', t('uploadError') || 'Upload error');
} finally {
setIsSending(false);
}
@@ -324,8 +324,8 @@ export default function MessageInput({ chatId }: MessageInputProps) {
newAttachments.push({ file, type: isAudio ? 'audio' : 'file' });
}
if (tooLarge) addNotification('warning', t('fileTooLarge') || 'Некоторые файлы слишком большие');
if (limitExceeded) addNotification('warning', 'Максимум 20 файлов');
if (tooLarge) addNotification('warning', t('fileTooLarge') || 'Some files are too large');
if (limitExceeded) addNotification('warning', t('maxFilesLimit' as any) || 'Maximum 20 files');
setAttachments(prev => [...prev, ...newAttachments]);
inputRef.current?.focus();
@@ -352,7 +352,7 @@ export default function MessageInput({ chatId }: MessageInputProps) {
newAttachments.push({ file, preview, type: isVideo ? 'video' : 'image' });
}
if (limitExceeded) addNotification('warning', 'Максимум 20 файлов');
if (limitExceeded) addNotification('warning', t('maxFilesLimit' as any) || 'Maximum 20 files');
setAttachments(prev => [...prev, ...newAttachments]);
inputRef.current?.focus();
@@ -567,8 +567,8 @@ export default function MessageInput({ chatId }: MessageInputProps) {
newAttachments.push({ file, type, preview });
}
if (tooLarge) addNotification('warning', t('fileTooLarge') || 'Некоторые файлы слишком большие');
if (limitExceeded) addNotification('warning', 'Максимум 20 файлов');
if (tooLarge) addNotification('warning', t('fileTooLarge') || 'Some files are too large');
if (limitExceeded) addNotification('warning', t('maxFilesLimit' as any) || 'Maximum 20 files');
setAttachments(prev => [...prev, ...newAttachments]);
inputRef.current?.focus();
@@ -624,7 +624,7 @@ export default function MessageInput({ chatId }: MessageInputProps) {
: `${t('replyTo')} ${replyTo?.sender?.displayName || replyTo?.sender?.userName || replyTo?.sender?.username || ''}`}
</p>
<div className="text-[13px] text-[#efeff3] truncate opacity-90 pl-1 border-l border-white/20 ml-0.5">
{replyTo?.quote ? `«${replyTo.quote}»` : (editingMessage || replyTo)?.content || t('media') || 'Медиа'}
{replyTo?.quote ? `«${replyTo.quote}»` : (editingMessage || replyTo)?.content || t('media')}
</div>
</div>
<button