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

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
+7 -4
View File
@@ -1,3 +1,4 @@
import { formatDate } from '../i18n/format.js';
import { t } from '../i18n/index.js';
// «Медиа и файлы» личной переписки: сетка фото и видео и список документов по месяцам.
// История догружается с сервера целиком; превью расшифровываются, только когда плитка видна.
@@ -14,7 +15,7 @@ import { navigateUp } from '../router.js';
export const pageMeta = { id: 'chat-media-view', get title() { return t('screens.chat_media_view.text_001'); } };
const monthTitle = new Intl.DateTimeFormat('ru-RU', { month: 'long', year: 'numeric' });
const monthTitle = (date) => formatDate(date, { month: 'long', year: 'numeric' });
// Все вложения переписки, от новых к старым.
function collectAttachments(chatId) {
@@ -37,11 +38,13 @@ function collectAttachments(chatId) {
function groupByMonth(entries) {
const groups = [];
for (const entry of entries) {
const raw = entry.timeMs ? monthTitle.format(new Date(entry.timeMs)) : t('screens.chat_media_view.text_003');
const date = entry.timeMs ? new Date(entry.timeMs) : null;
const key = date ? `${date.getFullYear()}-${date.getMonth()}` : 'unknown';
const raw = date ? monthTitle(date) : t('screens.chat_media_view.text_003');
const label = raw.charAt(0).toUpperCase() + raw.slice(1);
const last = groups[groups.length - 1];
if (last?.label === label) last.items.push(entry);
else groups.push({ label, items: [entry] });
if (last?.key === key) last.items.push(entry);
else groups.push({ key, label, items: [entry] });
}
return groups;
}