SHA256
Локализовать интерфейс SHiNE на русский и английский
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { t } from '../i18n/index.js';
|
||||
import {
|
||||
clearArweaveAttachmentHistory,
|
||||
formatArweaveHistoryTime,
|
||||
@@ -12,12 +13,12 @@ import { confirmDialog } from '../components/confirm-dialog.js';
|
||||
import { toUserMessage } from '../services/ui-error-texts.js';
|
||||
import { state } from '../state.js';
|
||||
|
||||
export const pageMeta = { id: 'arweave-uploads-view', title: 'Загрузка файлов' };
|
||||
export const pageMeta = { id: 'arweave-uploads-view', get title() { return t('screens.arweave_uploads_view.text_001'); } };
|
||||
|
||||
function setStatusBadge(node, status, label) {
|
||||
if (!node) return;
|
||||
node.className = `ar-attachment-status ar-attachment-status--${status || 'pending'}`;
|
||||
node.textContent = label || 'Проверяем...';
|
||||
node.textContent = label || t('screens.arweave_uploads_view.text_014');
|
||||
}
|
||||
|
||||
function renderTile(item, index) {
|
||||
@@ -31,7 +32,7 @@ function renderTile(item, index) {
|
||||
const status = document.createElement('span');
|
||||
status.className = 'ar-attachment-status ar-attachment-status--pending';
|
||||
status.dataset.statusIndex = String(index);
|
||||
status.textContent = 'Проверяем...';
|
||||
status.textContent = t('screens.arweave_uploads_view.text_002');
|
||||
|
||||
const meta = document.createElement('div');
|
||||
meta.className = 'ar-attachment-history-meta-row';
|
||||
@@ -43,7 +44,7 @@ function renderTile(item, index) {
|
||||
if (item.pendingPlacement) {
|
||||
const flag = document.createElement('span');
|
||||
flag.className = 'ar-attachment-placement-flag';
|
||||
flag.textContent = 'Ещё не прикреплён к записи';
|
||||
flag.textContent = t('screens.arweave_uploads_view.text_003');
|
||||
meta.append(flag);
|
||||
}
|
||||
|
||||
@@ -76,7 +77,7 @@ export function render({navigate, chrome}) {
|
||||
});
|
||||
renderHistory();
|
||||
} catch (error) {
|
||||
statusLine.textContent = toUserMessage(error, 'Не удалось загрузить файл.');
|
||||
statusLine.textContent = toUserMessage(error, t('screens.arweave_uploads_view.text_013'));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -88,7 +89,7 @@ export function render({navigate, chrome}) {
|
||||
if (!rows.length) {
|
||||
const empty = document.createElement('div');
|
||||
empty.className = 'empty-note';
|
||||
empty.textContent = 'Файлов пока нет. Нажмите «+», чтобы загрузить файл заранее и прикрепить его к записи позже.';
|
||||
empty.textContent = t('screens.arweave_uploads_view.text_004');
|
||||
list.append(empty);
|
||||
return;
|
||||
}
|
||||
@@ -101,7 +102,7 @@ export function render({navigate, chrome}) {
|
||||
attachment: item,
|
||||
})
|
||||
.then((result) => setStatusBadge(statusEl, result.status, result.label))
|
||||
.catch(() => setStatusBadge(statusEl, 'unavailable', 'Недоступен'));
|
||||
.catch(() => setStatusBadge(statusEl, 'unavailable', t('screens.arweave_uploads_view.text_015')));
|
||||
});
|
||||
|
||||
window.setTimeout(() => {
|
||||
@@ -110,40 +111,38 @@ export function render({navigate, chrome}) {
|
||||
}
|
||||
|
||||
const topbar = createTopBar({
|
||||
title: 'Файлы в блокчейне',
|
||||
title: t('screens.arweave_uploads_view.text_005'),
|
||||
back: { onClick: () => navigate('my-blockchain-view') },
|
||||
actions: [
|
||||
{
|
||||
icon: 'plus',
|
||||
title: 'Добавить файл',
|
||||
ariaLabel: 'Добавить файл',
|
||||
title: t('screens.arweave_uploads_view.text_006'),
|
||||
ariaLabel: t('screens.arweave_uploads_view.text_007'),
|
||||
className: 'arweave-uploads-add',
|
||||
onClick: () => { void uploadFile(); },
|
||||
},
|
||||
{
|
||||
iconNode: createOverflowDots(),
|
||||
title: 'Меню',
|
||||
ariaLabel: 'Меню загрузок',
|
||||
title: t('screens.arweave_uploads_view.text_008'),
|
||||
ariaLabel: t('screens.arweave_uploads_view.text_009'),
|
||||
className: 'arweave-uploads-menu-btn',
|
||||
menu: {
|
||||
minWidth: 220,
|
||||
items: [
|
||||
{ label: 'Добавить файл', action: () => uploadFile() },
|
||||
{ label: t('screens.arweave_uploads_view.text_010'), action: () => uploadFile() },
|
||||
{
|
||||
label: 'Очистить историю',
|
||||
label: t('screens.arweave_uploads_view.text_011'),
|
||||
action: async () => {
|
||||
const confirmed = await confirmDialog({ title: 'Очистить журнал?', text: 'Список загруженных в этой сессии файлов будет очищен. Сами файлы останутся в Arweave.', confirmLabel: 'Очистить', danger: true });
|
||||
const confirmed = await confirmDialog({ title: t('dialogs.pages.arweave_uploads_view.title_001'), text: t('dialogs.pages.arweave_uploads_view.text_002'), confirmLabel: t('dialogs.pages.arweave_uploads_view.confirmLabel_003'), danger: true });
|
||||
if (!confirmed) return;
|
||||
clearArweaveAttachmentHistory(state.session.login);
|
||||
renderHistory();
|
||||
},
|
||||
},
|
||||
{
|
||||
label: 'Справка',
|
||||
label: t('screens.arweave_uploads_view.text_012'),
|
||||
action: () => window.alert(
|
||||
'Здесь вы можете заранее добавить файл в Arweave или через Turbo. По умолчанию сразу выбрана загрузка через Turbo, а маленькие файлы пока загружаются там бесплатно.\n\n'
|
||||
+ 'Потом при создании сообщения можно открыть историю загрузок и выбрать уже загруженный файл по txId. '
|
||||
+ 'Если файл только что загружен, gateway может несколько минут его не отдавать, поэтому статус может быть “ещё обновляется”.'
|
||||
t('dialogs.final.uploads.help')
|
||||
),
|
||||
},
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user