Локализовать интерфейс SHiNE на русский и английский

This commit is contained in:
AidarKC
2026-11-09 16:45:21 +03:00
parent 526941eb33
commit 405b9a91a7
133 changed files with 12464 additions and 3296 deletions
+11 -10
View File
@@ -1,3 +1,4 @@
import { t } from '../i18n/index.js';
// Шторка «Заметка о человеке»: текст и цветная метка, видны только владельцу аккаунта.
// Открывается с карты связей и из профиля человека; хранение – services/people-notes.js.
import { openSheet } from './sheet.js';
@@ -7,7 +8,7 @@ export function openPersonNoteSheet({ login, name = '', onClose = null } = {}) {
const current = getPersonNote(login);
let mark = current?.mark || '';
return openSheet({
title: `Заметка: ${name || login}`,
title: t('dialogs.remaining.components.person_note_sheet.openpersonnotesheet.zametka_value1', { value1: name || login }),
className: 'person-note-sheet',
onClose,
content: (sheet) => {
@@ -15,27 +16,27 @@ export function openPersonNoteSheet({ login, name = '', onClose = null } = {}) {
wrap.className = 'stack person-note';
const hint = document.createElement('p');
hint.className = 'meta-muted person-note__hint';
hint.textContent = 'Видна только вам. Пока хранится на этом устройстве.';
hint.textContent = t('dialogs.modals.person_note_sheet.label_001');
const textarea = document.createElement('textarea');
textarea.className = 'input person-note__text';
textarea.rows = 5;
textarea.maxLength = PERSON_NOTE_MAX_TEXT;
textarea.placeholder = 'Кто это, откуда знакомы, о чём договорились…';
textarea.placeholder = t('dialogs.modals.person_note_sheet.label_002');
textarea.value = current?.text || '';
textarea.setAttribute('aria-label', 'Текст заметки');
textarea.setAttribute('aria-label', t('dialogs.modals.person_note_sheet.label_003'));
textarea.autofocus = true;
const marksLabel = document.createElement('div');
marksLabel.className = 'person-note__label';
marksLabel.id = `person-note-marks-${Math.random().toString(36).slice(2, 8)}`;
marksLabel.textContent = 'Метка на карте связей';
marksLabel.textContent = t('dialogs.modals.person_note_sheet.label_004');
const marks = document.createElement('div');
marks.className = 'person-note__marks';
marks.setAttribute('role', 'radiogroup');
marks.setAttribute('aria-labelledby', marksLabel.id);
const markButtons = [];
const syncMarks = () => markButtons.forEach((button) => button.setAttribute('aria-checked', String(button.dataset.mark === mark)));
for (const option of [{ id: '', label: 'Без метки' }, ...NOTE_MARKS]) {
for (const option of [{ id: '', label: t('dialogs.remaining.components.person_note_sheet.openpersonnotesheet.bez_metki') }, ...NOTE_MARKS]) {
const button = document.createElement('button');
button.type = 'button';
button.className = 'person-note__mark';
@@ -54,7 +55,7 @@ export function openPersonNoteSheet({ login, name = '', onClose = null } = {}) {
const remove = document.createElement('button');
remove.type = 'button';
remove.className = 'ghost-btn person-note__remove';
remove.textContent = 'Удалить';
remove.textContent = t('dialogs.modals.person_note_sheet.label_005');
remove.addEventListener('click', () => {
setPersonNote(login, { text: '', mark: '' });
sheet.close();
@@ -64,7 +65,7 @@ export function openPersonNoteSheet({ login, name = '', onClose = null } = {}) {
const save = document.createElement('button');
save.type = 'button';
save.className = 'primary-btn person-note__save';
save.textContent = 'Сохранить';
save.textContent = t('dialogs.modals.person_note_sheet.label_006');
save.addEventListener('click', () => {
setPersonNote(login, { text: textarea.value, mark });
sheet.close();
@@ -81,11 +82,11 @@ export function createPersonNotePreview(note, { className = '', onClick = null }
const el = document.createElement(onClick ? 'button' : 'div');
if (onClick) {
el.type = 'button';
el.title = 'Изменить заметку';
el.title = t('screens.person_note_sheet.text_001');
el.addEventListener('click', onClick);
}
el.className = `person-note-preview${className ? ` ${className}` : ''}`;
if (note.mark) el.dataset.mark = note.mark;
el.textContent = note.text.trim() || 'Метка без текста';
el.textContent = note.text.trim() || t('dialogs.modals.person_note_sheet.label_007');
return el;
}