feat(client): add RU/EN localization and native capture preview

This commit is contained in:
Loki 2026-10-24 15:04:50 +02:00
parent 8e5ab56611
commit 8460fb28fd
Signed by: boba
GPG key ID: 253067914055423B
43 changed files with 4103 additions and 275 deletions

View file

@ -35,6 +35,8 @@ component ThemeChoice inherits Rectangle {
}
export component AppearanceSettings inherits Rectangle {
in-out property <string> language-choice: "system";
callback language-selected(string);
in-out property <string> theme-mode;
in-out property <string> theme-css;
in-out property <string> theme-file-path;
@ -51,55 +53,66 @@ export component AppearanceSettings inherits Rectangle {
callback export-theme(string);
VerticalLayout {
spacing: 0; alignment: start;
Text { text: "Тема приложения"; color: Theme.text-primary; font-size: Theme.font-size + 2px; font-weight: 600; }
Text { text: "Один выбор для чата, комнат и настроек. Можно изменить в любой момент."; color: Theme.text-muted; font-size: Math.max(Theme.font-size - 3px, 11px); wrap: word-wrap; }
Text { text: @tr("Language"); color: Theme.text-primary; font-size: Theme.font-size + 2px; font-weight: 600; }
Text { text: @tr("Choose your language. Changes apply immediately."); color: Theme.text-muted; font-size: Math.max(Theme.font-size - 3px, 11px); wrap: word-wrap; }
Rectangle { height: 10px; }
HorizontalLayout {
spacing: 9px;
ActionButton { text: @tr("System default"); active: root.language-choice == "system"; clicked => { root.language-selected("system"); } }
ActionButton { text: "Русский"; active: root.language-choice == "ru"; clicked => { root.language-selected("ru"); } }
ActionButton { text: "English"; active: root.language-choice == "en"; clicked => { root.language-selected("en"); } }
Rectangle { horizontal-stretch: 1; }
}
Rectangle { height: 24px; }
Text { text: @tr("App theme"); color: Theme.text-primary; font-size: Theme.font-size + 2px; font-weight: 600; }
Text { text: @tr("One theme for chat, rooms and settings. Change it at any time."); color: Theme.text-muted; font-size: Math.max(Theme.font-size - 3px, 11px); wrap: word-wrap; }
Rectangle { height: 20px; }
HorizontalLayout {
spacing: 12px;
ThemeChoice { label: "Светлая"; selected: root.theme-mode == "light"; preview-background: #f5f4f2; preview-sidebar: #e6e4e0; preview-ink: #353330; clicked => { root.theme-selected("light"); } }
ThemeChoice { label: "Тёмная"; selected: root.theme-mode == "dark"; preview-background: #272729; preview-sidebar: #202022; preview-ink: #e9e7e4; clicked => { root.theme-selected("dark"); } }
ThemeChoice { label: "Мега-тёмная"; selected: root.theme-mode == "black"; preview-background: #080808; preview-sidebar: #131313; preview-ink: #dedbd5; clicked => { root.theme-selected("black"); } }
ThemeChoice { label: "Своя тема"; selected: root.theme-mode == "custom"; preview-background: Theme.bg-base; preview-sidebar: Theme.bg-surface; preview-ink: Theme.accent; clicked => { root.theme-selected("custom"); } }
ThemeChoice { label: @tr("Light"); selected: root.theme-mode == "light"; preview-background: #f5f4f2; preview-sidebar: #e6e4e0; preview-ink: #353330; clicked => { root.theme-selected("light"); } }
ThemeChoice { label: @tr("Dark"); selected: root.theme-mode == "dark"; preview-background: #272729; preview-sidebar: #202022; preview-ink: #e9e7e4; clicked => { root.theme-selected("dark"); } }
ThemeChoice { label: @tr("Extra dark"); selected: root.theme-mode == "black"; preview-background: #080808; preview-sidebar: #131313; preview-ink: #dedbd5; clicked => { root.theme-selected("black"); } }
ThemeChoice { label: @tr("Custom"); selected: root.theme-mode == "custom"; preview-background: Theme.bg-base; preview-sidebar: Theme.bg-surface; preview-ink: Theme.accent; clicked => { root.theme-selected("custom"); } }
}
Rectangle { height: 29px; }
Rectangle { height: 1px; background: Theme.border; }
Rectangle { height: 24px; }
HorizontalLayout {
Text { text: "Размер текста"; color: Theme.text-primary; font-size: Theme.font-size - 1px; font-weight: 600; horizontal-stretch: 1; }
Text { text: @tr("Text size"); color: Theme.text-primary; font-size: Theme.font-size - 1px; font-weight: 600; horizontal-stretch: 1; }
Text { text: Math.round(root.text-size) + " px"; color: Theme.text-secondary; font-size: Math.max(Theme.font-size - 2px, 11px); horizontal-alignment: right; }
}
Rectangle { height: 9px; }
AudioSlider { minimum: 12; maximum: 22; value <=> root.text-size; changed(value) => { root.text-size-changed(value); } }
Text { text: "Меняет масштаб текста во всём приложении."; color: Theme.text-muted; font-size: Math.max(Theme.font-size - 3px, 11px); wrap: word-wrap; }
Text { text: @tr("Adjust text size throughout the app."); color: Theme.text-muted; font-size: Math.max(Theme.font-size - 3px, 11px); wrap: word-wrap; }
Rectangle { height: 29px; }
if root.theme-mode == "custom" : VerticalLayout {
spacing: 12px; alignment: start;
Rectangle { height: 1px; background: Theme.border; }
Rectangle { height: 8px; }
HorizontalLayout {
Text { text: "Редактор темы"; color: Theme.text-primary; font-size: Theme.font-size + 2px; font-weight: 600; horizontal-stretch: 1; }
if root.theme-preview : Text { text: "Предпросмотр"; color: Theme.accent; font-size: Math.max(Theme.font-size - 3px, 11px); }
Text { text: @tr("Theme editor"); color: Theme.text-primary; font-size: Theme.font-size + 2px; font-weight: 600; horizontal-stretch: 1; }
if root.theme-preview : Text { text: @tr("Preview"); color: Theme.accent; font-size: Math.max(Theme.font-size - 3px, 11px); }
}
Text { text: "CSS-переменные в блоке :root меняют цвета и размер текста. Обычные CSS-селекторы, стили размещения и внешние ресурсы не поддерживаются."; color: Theme.text-muted; font-size: Math.max(Theme.font-size - 3px, 11px); wrap: word-wrap; }
Text { text: @tr("CSS variables in :root control colours and text size. CSS selectors, layout rules and external resources are not supported."); color: Theme.text-muted; font-size: Math.max(Theme.font-size - 3px, 11px); wrap: word-wrap; }
ThemeEditor { text <=> root.theme-css; height: 220px; }
HorizontalLayout {
spacing: 9px;
ActionButton { text: "Предпросмотр"; clicked => { root.preview-theme(root.theme-css); } }
ActionButton { text: "Применить"; active: true; clicked => { root.apply-theme(root.theme-css); } }
ActionButton { text: @tr("Preview"); clicked => { root.preview-theme(root.theme-css); } }
ActionButton { text: @tr("Apply"); active: true; clicked => { root.apply-theme(root.theme-css); } }
Rectangle { horizontal-stretch: 1; }
ActionButton { text: "Сбросить"; quiet: true; clicked => { root.reset-theme(); } }
ActionButton { text: @tr("Reset"); quiet: true; clicked => { root.reset-theme(); } }
}
Text { text: "Основные переменные: --vnox-bg, --vnox-surface, --vnox-text, --vnox-accent, --vnox-font-size. Полный список описан в документации тем."; color: Theme.text-muted; font-size: Math.max(Theme.font-size - 4px, 11px); wrap: word-wrap; }
Text { text: @tr("Main variables: --vnox-bg, --vnox-surface, --vnox-text, --vnox-accent, --vnox-font-size. See the theme documentation for the full list."); color: Theme.text-muted; font-size: Math.max(Theme.font-size - 4px, 11px); wrap: word-wrap; }
Rectangle { height: 8px; }
Rectangle { height: 1px; background: Theme.border; }
Rectangle { height: 8px; }
Text { text: "Файл темы"; color: Theme.text-primary; font-size: Theme.font-size - 1px; font-weight: 600; }
Text { text: "Введи локальный путь к .css, чтобы импортировать тему или сохранить её в файл."; color: Theme.text-muted; font-size: Math.max(Theme.font-size - 3px, 11px); wrap: word-wrap; }
ThemeInput { text <=> root.theme-file-path; placeholder-text: "Например: /home/user/themes/my-vnox.css"; accepted => { root.import-theme(root.theme-file-path); } }
Text { text: @tr("Theme file"); color: Theme.text-primary; font-size: Theme.font-size - 1px; font-weight: 600; }
Text { text: @tr("Enter a local .css path to import or export a theme."); color: Theme.text-muted; font-size: Math.max(Theme.font-size - 3px, 11px); wrap: word-wrap; }
ThemeInput { text <=> root.theme-file-path; placeholder-text: @tr("For example: /home/user/themes/my-vnox.css"); accepted => { root.import-theme(root.theme-file-path); } }
HorizontalLayout {
spacing: 9px;
ActionButton { text: "Импортировать"; clicked => { root.import-theme(root.theme-file-path); } }
ActionButton { text: "Экспортировать"; clicked => { root.export-theme(root.theme-file-path); } }
ActionButton { text: @tr("Import"); clicked => { root.import-theme(root.theme-file-path); } }
ActionButton { text: @tr("Export"); clicked => { root.export-theme(root.theme-file-path); } }
Rectangle { horizontal-stretch: 1; }
}
}