From 8db2b1bb6b68175363084a5e4684a5a2169b9fcf Mon Sep 17 00:00:00 2001 From: busya Date: Wed, 27 May 2026 16:53:20 +0300 Subject: [PATCH] fix: replace hardcoded UI labels with i18n translations - Add missing i18n keys to common.json, reports.json, dashboard.json, tasks.json, git.json (EN + RU) - Replace all hardcoded labels in LLM report page with .reports.* keys - Replace hardcoded tab labels (Linked resources, Git history) in DashboardDetail page - Replace hardcoded RU text in DashboardGitManager with .git.* keys - Remove hardcoded fallback strings from DashboardHeader, DashboardTaskHistory --- frontend/src/lib/i18n/locales/en/common.json | 7 ++- .../src/lib/i18n/locales/en/dashboard.json | 7 +++ frontend/src/lib/i18n/locales/en/git.json | 8 ++++ frontend/src/lib/i18n/locales/en/reports.json | 22 +++++++++- frontend/src/lib/i18n/locales/en/tasks.json | 4 +- frontend/src/lib/i18n/locales/ru/common.json | 7 ++- .../src/lib/i18n/locales/ru/dashboard.json | 7 +++ frontend/src/lib/i18n/locales/ru/git.json | 8 ++++ frontend/src/lib/i18n/locales/ru/reports.json | 22 +++++++++- frontend/src/lib/i18n/locales/ru/tasks.json | 4 +- .../src/routes/dashboards/[id]/+page.svelte | 8 ++-- .../components/DashboardGitManager.svelte | 28 ++++++------ .../[id]/components/DashboardHeader.svelte | 8 ++-- .../components/DashboardTaskHistory.svelte | 20 ++++----- .../routes/reports/llm/[taskId]/+page.svelte | 44 +++++++++---------- 15 files changed, 144 insertions(+), 60 deletions(-) diff --git a/frontend/src/lib/i18n/locales/en/common.json b/frontend/src/lib/i18n/locales/en/common.json index 303626a3..31632493 100644 --- a/frontend/src/lib/i18n/locales/en/common.json +++ b/frontend/src/lib/i18n/locales/en/common.json @@ -30,5 +30,10 @@ "per_page": "per page", "close_modal": "Close modal", "prod_context_warning": "PROD context active", - "choose_environment": "-- Choose an environment --" + "choose_environment": "-- Choose an environment --", + "type": "Type", + "status": "Status", + "started": "Started", + "finished": "Finished", + "duration": "Duration" } diff --git a/frontend/src/lib/i18n/locales/en/dashboard.json b/frontend/src/lib/i18n/locales/en/dashboard.json index a95e6f64..3db17a0d 100644 --- a/frontend/src/lib/i18n/locales/en/dashboard.json +++ b/frontend/src/lib/i18n/locales/en/dashboard.json @@ -98,6 +98,13 @@ "status_synced": "Synced", "status_diff": "Diff", "status_error": "Error", + "linked_resources": "Linked resources", + "git_history": "Git history", + "run_backup": "Run backup", + "run_llm_check": "Run LLM check", + "thumbnail_generating": "Thumbnail is being generated", + "thumbnail_failed": "Failed to load thumbnail", + "thumbnail_unavailable": "Thumbnail is unavailable", "empty": "No dashboards found", "setup_badge": "Initial setup", "setup_title": "Configure your first environment", diff --git a/frontend/src/lib/i18n/locales/en/git.json b/frontend/src/lib/i18n/locales/en/git.json index cd66e02c..116b0696 100644 --- a/frontend/src/lib/i18n/locales/en/git.json +++ b/frontend/src/lib/i18n/locales/en/git.json @@ -74,6 +74,14 @@ "diverged": "Diverged", "error": "Error" }, + "repo_changes_detected": "Configuration changes detected in Superset.", + "repo_synced_with_branch": "Superset configuration matches branch {branch}.", + "charts_label": "charts: {count}", + "datasets_label": "datasets: {count}", + "files_label": "files: {count}", + "sync_and_commit": "Sync & Commit", + "show_diff": "Show diff", + "init_repo_button": "Initialize Git Repository", "unfinished_merge": { "title": "Repository has an unfinished merge", "default_message": "An unfinished merge was detected. Resolve conflicts or abort merge manually, then retry Pull.", diff --git a/frontend/src/lib/i18n/locales/en/reports.json b/frontend/src/lib/i18n/locales/en/reports.json index fde9fbbb..58011e4d 100644 --- a/frontend/src/lib/i18n/locales/en/reports.json +++ b/frontend/src/lib/i18n/locales/en/reports.json @@ -20,5 +20,25 @@ "updated": "Updated", "summary": "Summary", "severity": "Severity", - "message": "Message" + "message": "Message", + "llm_task_id": "Task: {taskId}", + "llm_status": "Status", + "llm_dashboard_check": "Dashboard check", + "llm_started": "Started", + "llm_finished": "Finished", + "llm_duration": "Duration", + "llm_text_report": "Text Report", + "llm_location": "Location: {location}", + "llm_screenshots": "Screenshots", + "llm_no_screenshots": "No screenshots saved.", + "llm_failed_screenshot": "Failed to load screenshot", + "llm_logs_sent": "Logs sent to LLM ({count})", + "llm_no_source_logs": "No source logs were attached.", + "llm_task_logs": "Task execution logs ({count})", + "llm_no_task_logs": "No task logs available.", + "load_failed": "Failed to load report", + "llm_time": "Time", + "llm_level": "Level", + "llm_source": "Source", + "llm_message": "Message" } diff --git a/frontend/src/lib/i18n/locales/en/tasks.json b/frontend/src/lib/i18n/locales/en/tasks.json index 2042be3c..f9aa82ed 100644 --- a/frontend/src/lib/i18n/locales/en/tasks.json +++ b/frontend/src/lib/i18n/locales/en/tasks.json @@ -69,5 +69,7 @@ "show_diff": "Show diff", "diff_preview": "Diff preview", "no_diff_available": "Diff is not available", - "summary_link_unavailable": "Deep link or diff is unavailable for this task" + "summary_link_unavailable": "Deep link or diff is unavailable for this task", + "open_llm_report": "LLM report", + "result": "Check" } diff --git a/frontend/src/lib/i18n/locales/ru/common.json b/frontend/src/lib/i18n/locales/ru/common.json index 295e6fe0..a0c6fd32 100644 --- a/frontend/src/lib/i18n/locales/ru/common.json +++ b/frontend/src/lib/i18n/locales/ru/common.json @@ -30,5 +30,10 @@ "per_page": "на страницу", "close_modal": "Закрыть модальное окно", "prod_context_warning": "Активен PROD-контекст", - "choose_environment": "-- Выберите окружение --" + "choose_environment": "-- Выберите окружение --", + "type": "Тип", + "status": "Статус", + "started": "Запущено", + "finished": "Завершено", + "duration": "Длительность" } diff --git a/frontend/src/lib/i18n/locales/ru/dashboard.json b/frontend/src/lib/i18n/locales/ru/dashboard.json index c980fea9..3dc11049 100644 --- a/frontend/src/lib/i18n/locales/ru/dashboard.json +++ b/frontend/src/lib/i18n/locales/ru/dashboard.json @@ -97,6 +97,13 @@ "status_synced": "Синхронизировано", "status_diff": "Различия", "status_error": "Ошибка", + "linked_resources": "Связанные ресурсы", + "git_history": "История Git", + "run_backup": "Запустить бэкап", + "run_llm_check": "LLM проверка", + "thumbnail_generating": "Миниатюра генерируется", + "thumbnail_failed": "Не удалось загрузить миниатюру", + "thumbnail_unavailable": "Миниатюра недоступна", "empty": "Дашборды не найдены", "setup_badge": "Стартовая настройка", "setup_title": "Настройте первое окружение", diff --git a/frontend/src/lib/i18n/locales/ru/git.json b/frontend/src/lib/i18n/locales/ru/git.json index b104ea68..f3874912 100644 --- a/frontend/src/lib/i18n/locales/ru/git.json +++ b/frontend/src/lib/i18n/locales/ru/git.json @@ -74,6 +74,14 @@ "diverged": "Расхождение", "error": "Ошибка" }, + "repo_changes_detected": "Обнаружены изменения конфигурации в Superset.", + "repo_synced_with_branch": "Конфигурация Superset совпадает с веткой {branch}.", + "charts_label": "чарты: {count}", + "datasets_label": "датасеты: {count}", + "files_label": "файлы: {count}", + "sync_and_commit": "Синхронизировать и зафиксировать", + "show_diff": "Показать diff", + "init_repo_button": "Инициализировать Git-репозиторий", "unfinished_merge": { "title": "Незавершённое слияние в репозитории", "default_message": "В репозитории найдено незавершённое слияние. Завершите или отмените его вручную и повторите Pull.", diff --git a/frontend/src/lib/i18n/locales/ru/reports.json b/frontend/src/lib/i18n/locales/ru/reports.json index 40911943..09c7f5ea 100644 --- a/frontend/src/lib/i18n/locales/ru/reports.json +++ b/frontend/src/lib/i18n/locales/ru/reports.json @@ -20,5 +20,25 @@ "updated": "Обновлено", "summary": "Сводка", "severity": "Серьезность", - "message": "Сообщение" + "message": "Сообщение", + "llm_task_id": "Задача: {taskId}", + "llm_status": "Статус", + "llm_dashboard_check": "Проверка дашборда", + "llm_started": "Запущено", + "llm_finished": "Завершено", + "llm_duration": "Длительность", + "llm_text_report": "Текстовый отчет", + "llm_location": "Локация: {location}", + "llm_screenshots": "Скриншоты", + "llm_no_screenshots": "Скриншоты не сохранены.", + "llm_failed_screenshot": "Не удалось загрузить скриншот", + "llm_logs_sent": "Логи, отправленные LLM ({count})", + "llm_no_source_logs": "Исходные логи не были прикреплены.", + "llm_task_logs": "Логи выполнения задачи ({count})", + "llm_no_task_logs": "Логи задачи недоступны.", + "load_failed": "Не удалось загрузить отчет", + "llm_time": "Время", + "llm_level": "Уровень", + "llm_source": "Источник", + "llm_message": "Сообщение" } diff --git a/frontend/src/lib/i18n/locales/ru/tasks.json b/frontend/src/lib/i18n/locales/ru/tasks.json index 1b4d8698..75195b0b 100644 --- a/frontend/src/lib/i18n/locales/ru/tasks.json +++ b/frontend/src/lib/i18n/locales/ru/tasks.json @@ -69,5 +69,7 @@ "show_diff": "Показать Diff", "diff_preview": "Diff предпросмотр", "no_diff_available": "Diff недоступен", - "summary_link_unavailable": "Ссылка или diff недоступны для этой задачи" + "summary_link_unavailable": "Ссылка или diff недоступны для этой задачи", + "open_llm_report": "LLM отчет", + "result": "Проверка" } diff --git a/frontend/src/routes/dashboards/[id]/+page.svelte b/frontend/src/routes/dashboards/[id]/+page.svelte index 2aaf8245..e986232a 100644 --- a/frontend/src/routes/dashboards/[id]/+page.svelte +++ b/frontend/src/routes/dashboards/[id]/+page.svelte @@ -576,7 +576,7 @@ class="rounded-lg border border-rose-300 bg-rose-50 px-4 py-3 text-sm text-rose-800" >
- {$t.dashboard?.llm_not_configured || "LLM is not configured"} + {$t.dashboard?.llm_not_configured}
{#if llmStatusReason === "no_active_provider"} @@ -709,19 +709,19 @@ class={`rounded-md px-3 py-1.5 text-sm font-medium transition-colors ${activeTab === "resources" ? "bg-slate-900 text-white" : "bg-slate-100 text-slate-700 hover:bg-slate-200"}`} onclick={() => (activeTab = "resources")} > - Linked resources + {$t.dashboard?.linked_resources || "Linked resources"}
diff --git a/frontend/src/routes/dashboards/[id]/components/DashboardGitManager.svelte b/frontend/src/routes/dashboards/[id]/components/DashboardGitManager.svelte index 3254c474..0b68ea61 100644 --- a/frontend/src/routes/dashboards/[id]/components/DashboardGitManager.svelte +++ b/frontend/src/routes/dashboards/[id]/components/DashboardGitManager.svelte @@ -37,14 +37,14 @@

- {$t.git?.management || "Git Repository"} + {$t.git?.management}

@@ -61,34 +61,34 @@ {:else if !hasGitRepo}
- {$t.git?.not_linked || "Этот дашборд еще не привязан к Git-репозиторию."} + {$t.git?.not_linked}
{:else}

{#if gitSyncState === "CHANGES"} - Обнаружены изменения конфигурации в Superset. + {$t.git?.repo_changes_detected} {:else} - Конфигурация Superset совпадает с веткой {gitStatus?.current_branch || "main"}. + {$t.git?.repo_synced_with_branch?.replace("{branch}", gitStatus?.current_branch || "main")} {/if}

- charts: {changedChartsCount} + {$t.git?.charts_label?.replace("{count}", changedChartsCount)} - datasets: {changedDatasetsCount} + {$t.git?.datasets_label?.replace("{count}", changedDatasetsCount)} - files: {allChangedFiles.length} + {$t.git?.files_label?.replace("{count}", allChangedFiles.length)}
@@ -98,14 +98,14 @@ onclick={runGitSyncAndOpenCommit} disabled={isSyncingGit || !hasChangesToCommit} > - {isSyncingGit ? $t.common?.loading || "Loading..." : "Синхронизировать и зафиксировать"} + {isSyncingGit ? $t.common?.loading : $t.git?.sync_and_commit}
@@ -115,7 +115,7 @@ onclick={runGitPull} disabled={isPullingGit} > - {isPullingGit ? $t.common?.loading || "Loading..." : $t.git?.pull || "Pull"} + {isPullingGit ? $t.common?.loading : $t.git?.pull}
diff --git a/frontend/src/routes/dashboards/[id]/components/DashboardHeader.svelte b/frontend/src/routes/dashboards/[id]/components/DashboardHeader.svelte index b268b3c2..5e038c5f 100644 --- a/frontend/src/routes/dashboards/[id]/components/DashboardHeader.svelte +++ b/frontend/src/routes/dashboards/[id]/components/DashboardHeader.svelte @@ -75,22 +75,22 @@ class="inline-flex items-center justify-center rounded-lg border border-slate-300 bg-white px-4 py-2 text-sm font-medium text-slate-700 transition-colors hover:bg-slate-50" onclick={() => (showGitManager = true)} > - {$t.git?.management || "Manage Git"} + {$t.git?.management} {#if isTaskHistoryLoading} @@ -49,19 +49,19 @@ {:else if taskHistory.length === 0}
- {$t.tasks?.select_task || "No backup/LLM tasks yet"} + {$t.tasks?.select_task}
{:else}
- - - - - - + + + + + + @@ -93,7 +93,7 @@ class="inline-flex items-center gap-1 rounded-md border border-indigo-300 bg-indigo-50 px-2 py-1 text-xs text-indigo-700 hover:bg-indigo-100" onclick={() => openLlmReport(task.id)} > - {$t.tasks?.open_llm_report || "LLM report"} + {$t.tasks?.open_llm_report} {/if} diff --git a/frontend/src/routes/reports/llm/[taskId]/+page.svelte b/frontend/src/routes/reports/llm/[taskId]/+page.svelte index db47109e..4ab7faef 100644 --- a/frontend/src/routes/reports/llm/[taskId]/+page.svelte +++ b/frontend/src/routes/reports/llm/[taskId]/+page.svelte @@ -91,7 +91,7 @@ task = taskPayload; logs = Array.isArray(logsPayload) ? logsPayload : []; } catch (err) { - error = err?.message || "Failed to load LLM report"; + error = err?.message || $t.reports?.load_failed || "Failed to load LLM report"; } finally { isLoading = false; } @@ -129,7 +129,7 @@ const blob = await api.getStorageFileBlob(path); nextUrls[path] = URL.createObjectURL(blob); } catch (err) { - nextErrors[path] = err?.message || "Failed to load screenshot"; + nextErrors[path] = err?.message || $t.reports?.llm_failed_screenshot || "Failed to load screenshot"; } }), ); @@ -192,7 +192,7 @@

{$t.tasks?.result_llm_validation || "LLM Validation Report"}

-

Task: {taskId}

+

{$t.reports?.llm_task_id?.replace("{taskId}", taskId) || `Task: ${taskId}`}

{$t.reports?.llm_time || "Time"}{$t.reports?.llm_level || "Level"}{$t.reports?.llm_source || "Source"}{$t.reports?.llm_message || "Message"}
{$t.common?.type || "Type"}{$t.common?.status || "Status"}{$t.tasks?.result || "Check"}{$t.common?.started || "Started"}{$t.common?.finished || "Finished"}{$t.common?.actions || "Actions"}{$t.common?.type}{$t.common?.status}{$t.tasks?.result}{$t.common?.started}{$t.common?.finished}{$t.common?.actions}
Time Level Source Message