feat(ui): localize commit AI and git error messages to English
Translate commit AI prompts, model labels, and git/keychain errors to English so the app and generated messages are consistent. Also add a discard confirmation dialog and update the UI text/styles to match the new flow. - src-tauri/crates/commit_ai/src/cloud.rs - Translate HTTP and API error messages to English. - Keep request timeout and token sizing behavior unchanged. - src-tauri/crates/commit_ai/src/lib.rs - Translate model labels, prompt text, and validation errors. - Keep diff truncation and message sanitization logic intact. - src-tauri/src/git.rs - Translate git, credential, merge, and history errors. - Update AI provider validation messages to English. - src/lib/components/* - Update AI settings, commit panel, credential, and loading UI text. - Add discard confirmation dialog for destructive actions. - src/App.svelte, src/app.css - Adjust app layout and styling for the new dialog and text changes.
This commit is contained in:
+133
-7
@@ -150,6 +150,19 @@
|
||||
background: linear-gradient(180deg, rgba(65, 209, 255, 0.18), rgba(100, 108, 255, 0.16));
|
||||
}
|
||||
|
||||
.btn-danger {
|
||||
border-color: rgba(255, 90, 103, 0.72);
|
||||
color: #ffffff;
|
||||
background: linear-gradient(135deg, rgba(255, 90, 103, 0.92), rgba(195, 44, 64, 0.9));
|
||||
box-shadow: 0 0 22px rgba(255, 90, 103, 0.16);
|
||||
font-weight: 700;
|
||||
}
|
||||
.btn-danger:hover:not(:disabled) {
|
||||
border-color: rgba(255, 161, 169, 0.86);
|
||||
color: #ffffff;
|
||||
background: linear-gradient(135deg, rgba(255, 111, 124, 0.96), rgba(214, 55, 77, 0.95));
|
||||
}
|
||||
|
||||
.panel {
|
||||
min-width: 0;
|
||||
min-height: 0;
|
||||
@@ -940,13 +953,39 @@
|
||||
.top-section {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
grid-template-rows: minmax(0, 1fr) minmax(210px, auto);
|
||||
grid-template-rows: minmax(120px, 1fr) 14px var(--commit-panel-height, 220px);
|
||||
min-height: 0;
|
||||
gap: 8px;
|
||||
gap: 0;
|
||||
padding: 8px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.panel-resize-handle {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: row-resize;
|
||||
touch-action: none;
|
||||
}
|
||||
.panel-resize-handle::before {
|
||||
content: "";
|
||||
width: 40px;
|
||||
height: 3px;
|
||||
border-radius: 999px;
|
||||
background: var(--color-border);
|
||||
transition: background-color 0.15s ease;
|
||||
}
|
||||
.panel-resize-handle:hover::before,
|
||||
.panel-resize-handle.resizing::before {
|
||||
background: var(--color-accent);
|
||||
}
|
||||
.panel-resize-handle:focus-visible {
|
||||
outline: 2px solid var(--color-accent);
|
||||
outline-offset: -2px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
/* --- File list / change lanes --- */
|
||||
|
||||
.file-list { padding: 6px; overflow: auto; }
|
||||
@@ -1330,9 +1369,35 @@
|
||||
|
||||
/* --- Commit form --- */
|
||||
|
||||
.commit-form { display: flex; flex-direction: column; flex: 1 1 0; min-height: 0; gap: 8px; padding: 10px; }
|
||||
.commit-form textarea { flex: 1 1 0; min-height: 80px; resize: none; }
|
||||
.commit-actions-row { display: flex; gap: 8px; }
|
||||
.commit-panel {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
.commit-panel .section-head { flex: 0 0 auto; }
|
||||
.commit-form {
|
||||
display: grid;
|
||||
grid-template-rows: minmax(0, 1fr) auto auto;
|
||||
flex: 1 1 0;
|
||||
min-height: 0;
|
||||
gap: 8px;
|
||||
padding: 10px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.commit-form textarea {
|
||||
min-height: 0;
|
||||
height: 100%;
|
||||
resize: none;
|
||||
overflow: auto;
|
||||
}
|
||||
.commit-actions-row {
|
||||
display: flex;
|
||||
flex: 0 0 auto;
|
||||
gap: 8px;
|
||||
min-width: 0;
|
||||
}
|
||||
.commit-actions-row .btn-primary { min-width: 0; }
|
||||
.commit-ai-button { flex: 0 0 auto; min-width: 64px; justify-content: center; }
|
||||
.commit-ai-settings-button { flex: 0 0 auto; width: 38px; min-width: 38px; padding: 0; justify-content: center; }
|
||||
.commit-block-reason {
|
||||
@@ -1606,6 +1671,14 @@
|
||||
max-height: calc(100vh - 32px);
|
||||
overflow: auto;
|
||||
}
|
||||
.discard-confirm-dialog {
|
||||
display: grid;
|
||||
grid-template-rows: auto auto auto;
|
||||
width: min(560px, calc(100vw - 32px));
|
||||
height: auto;
|
||||
max-height: calc(100vh - 32px);
|
||||
overflow: auto;
|
||||
}
|
||||
.ai-settings-dialog {
|
||||
display: block;
|
||||
width: min(560px, calc(100vw - 32px));
|
||||
@@ -1857,6 +1930,59 @@
|
||||
|
||||
.prepared-tag { display: inline-flex; align-items: center; gap: 4px; margin-right: auto; color: #4eca76; font-size: 12px; font-weight: 700; }
|
||||
|
||||
.discard-confirm-body {
|
||||
display: grid;
|
||||
grid-template-columns: auto minmax(0, 1fr);
|
||||
gap: 14px;
|
||||
padding: 18px 16px 16px;
|
||||
}
|
||||
.discard-warning-icon {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 42px;
|
||||
height: 42px;
|
||||
border: 1px solid rgba(255, 90, 103, 0.32);
|
||||
border-radius: 10px;
|
||||
color: #ff9aa4;
|
||||
background: rgba(255, 90, 103, 0.1);
|
||||
}
|
||||
.discard-confirm-copy {
|
||||
display: grid;
|
||||
gap: 10px;
|
||||
min-width: 0;
|
||||
color: var(--color-ink-muted);
|
||||
font-size: 13px;
|
||||
line-height: 1.45;
|
||||
}
|
||||
.discard-confirm-copy p { margin: 0; }
|
||||
.discard-target {
|
||||
display: block;
|
||||
min-width: 0;
|
||||
max-height: 84px;
|
||||
overflow: auto;
|
||||
padding: 8px 9px;
|
||||
border: 1px solid var(--color-border-subtle);
|
||||
border-radius: 6px;
|
||||
color: var(--color-ink);
|
||||
background: rgba(0, 0, 0, 0.18);
|
||||
font-family: var(--font-mono);
|
||||
font-size: 12px;
|
||||
white-space: pre-wrap;
|
||||
word-break: break-word;
|
||||
}
|
||||
.discard-warning-text {
|
||||
color: #ffb8bf;
|
||||
font-weight: 650;
|
||||
}
|
||||
.discard-confirm-actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 8px;
|
||||
padding: 12px 16px 14px;
|
||||
border-top: 1px solid var(--color-border-subtle);
|
||||
background: var(--color-surface-dim);
|
||||
}
|
||||
|
||||
.line-patch-body {
|
||||
display: grid;
|
||||
grid-template-rows: minmax(0, 1fr);
|
||||
@@ -2893,7 +3019,7 @@
|
||||
/* Stack CommitPanel below StatusPanel; history panels stay side by side */
|
||||
@media (max-width: 1100px) {
|
||||
.workspace { grid-template-columns: clamp(185px, 16vw, 220px) minmax(0, 1fr) clamp(380px, 38vw, 500px); }
|
||||
.top-section { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) 190px; }
|
||||
.top-section { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) 14px var(--commit-panel-height, 190px); }
|
||||
}
|
||||
|
||||
/* Compact: stack history panels vertically, narrow sidebars */
|
||||
@@ -2919,7 +3045,7 @@
|
||||
.workspace { grid-template-columns: 1fr; gap: 6px; }
|
||||
.history-aside { grid-template-columns: 1fr; grid-template-rows: minmax(200px, 1fr) minmax(150px, 0.5fr); min-height: 380px; }
|
||||
.left-sidebar { grid-template-rows: minmax(200px, 1fr) minmax(240px, 1.2fr); min-height: 440px; }
|
||||
.top-section { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) 190px; }
|
||||
.top-section { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) 14px var(--commit-panel-height, 190px); }
|
||||
.repo-form { grid-template-columns: 1fr; }
|
||||
.repo-tabbar { grid-template-columns: minmax(0, 1fr) auto; }
|
||||
.repo-tab.management { min-width: 0; }
|
||||
|
||||
Reference in New Issue
Block a user