Локализовать интерфейс 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
+18 -17
View File
@@ -1,3 +1,4 @@
import { t, th } from '../i18n/index.js';
// Редактор точной настройки палитры.
import {
PALETTE_PRESETS,
@@ -19,36 +20,36 @@ export function openPaletteEditor({ theme = resolveThemeMode(), onClose } = {})
modal.innerHTML = `
<div class="modal-card palette-editor__card" role="dialog" aria-modal="true" aria-labelledby="palette-editor-title">
<div class="palette-editor__head">
<h2 class="modal-title" id="palette-editor-title">Цвета оформления</h2>
<button class="icon-btn palette-editor__close" type="button" aria-label="Закрыть">✕</button>
<h2 class="modal-title" id="palette-editor-title">${th('screens.palette_editor.text_003')}</h2>
<button class="icon-btn palette-editor__close" type="button" aria-label="${th('screens.palette_editor.text_004')}">✕</button>
</div>
<div class="palette-editor__section">
<span class="palette-editor__label">Основа</span>
<select class="input palette-editor__presets" aria-label="Готовая цветовая тема"></select>
<span class="palette-editor__label">${th('screens.palette_editor.text_005')}</span>
<select class="input palette-editor__presets" aria-label="${th('screens.palette_editor.text_006')}"></select>
<div class="palette-editor__preview" aria-hidden="true"><span></span><span></span><span></span><span></span></div>
</div>
<div class="palette-editor__section">
<span class="palette-editor__label">Настраиваемая тема</span>
<div class="tabs tabs--auto" role="radiogroup" aria-label="Тема для настройки">
<button type="button" class="tab-btn" role="radio" data-edit-theme="light">День</button>
<button type="button" class="tab-btn" role="radio" data-edit-theme="dark">Ночь</button>
<span class="palette-editor__label">${th('screens.palette_editor.text_007')}</span>
<div class="tabs tabs--auto" role="radiogroup" aria-label="${th('screens.palette_editor.text_008')}">
<button type="button" class="tab-btn" role="radio" data-edit-theme="light">${th('screens.palette_editor.text_009')}</button>
<button type="button" class="tab-btn" role="radio" data-edit-theme="dark">${th('screens.palette_editor.text_010')}</button>
</div>
<p class="palette-editor__hint">Правки видны сразу. Меняется только выбранная тема.</p>
<p class="palette-editor__hint">${th('screens.palette_editor.text_011')}</p>
</div>
<div class="palette-editor__roles"></div>
<details class="palette-editor__share">
<summary>Поделиться палитрой</summary>
<p class="palette-editor__hint">Скопируйте текст и отправьте команде или вставьте чужую палитру и нажмите «Применить».</p>
<summary>${th('screens.palette_editor.text_012')}</summary>
<p class="palette-editor__hint">${th('screens.palette_editor.text_013')}</p>
<textarea class="input palette-editor__json" rows="8" spellcheck="false"></textarea>
<p class="palette-editor__error" role="alert" hidden></p>
<div class="palette-editor__actions">
<button type="button" class="secondary-btn" data-action="copy">Скопировать</button>
<button type="button" class="secondary-btn" data-action="import">Применить</button>
<button type="button" class="secondary-btn" data-action="copy">${th('screens.palette_editor.text_014')}</button>
<button type="button" class="secondary-btn" data-action="import">${th('screens.palette_editor.text_015')}</button>
</div>
</details>
<div class="palette-editor__actions">
<button type="button" class="secondary-btn" data-action="reset-theme">Сбросить эту тему</button>
<button type="button" class="primary-btn" data-action="done">Готово</button>
<button type="button" class="secondary-btn" data-action="reset-theme">${th('screens.palette_editor.text_016')}</button>
<button type="button" class="primary-btn" data-action="done">${th('screens.palette_editor.text_017')}</button>
</div>
</div>
`;
@@ -91,7 +92,7 @@ export function openPaletteEditor({ theme = resolveThemeMode(), onClose } = {})
const changed = Boolean(custom[role.id]);
row.innerHTML = `
<input type="color" value="${colors[role.id]}" aria-label="${role.label}">
<span class="palette-editor__role-name">${role.label}${changed ? ' <span class="palette-editor__changed">изменён</span>' : ''}</span>
<span class="palette-editor__role-name">${role.label}${changed ? t('screens.palette_editor.text_002') : ''}</span>
<code class="palette-editor__role-value">${colors[role.id]}</code>
`;
const input = row.querySelector('input');
@@ -135,7 +136,7 @@ export function openPaletteEditor({ theme = resolveThemeMode(), onClose } = {})
importPalette(jsonEl.value);
render();
} catch {
errorEl.textContent = 'Не удалось прочитать палитру: проверьте, что текст скопирован целиком.';
errorEl.textContent = t('screens.palette_editor.text_001');
errorEl.hidden = false;
}
}