Skip to content

Commit e5be214

Browse files
committed
refactor(interruption): replace hardcoded response messages with localized strings and remove unused message constants
1 parent 3bbf984 commit e5be214

File tree

21 files changed

+75
-14
lines changed

21 files changed

+75
-14
lines changed

src/core/task/Task.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ import { type AssistantMessageContent, presentAssistantMessage } from "../assist
8888
import { AssistantMessageParser } from "../assistant-message/AssistantMessageParser"
8989
import { truncateConversationIfNeeded } from "../sliding-window"
9090
import { ClineProvider } from "../webview/ClineProvider"
91-
import { RESPONSE_INTERRUPTED_BY_API_ERROR, RESPONSE_INTERRUPTED_BY_USER } from "../../shared/messages"
9291
import { MultiSearchReplaceDiffStrategy } from "../diff/strategies/multi-search-replace"
9392
import { MultiFileSearchReplaceDiffStrategy } from "../diff/strategies/multi-file-search-replace"
9493
import {
@@ -1909,8 +1908,8 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
19091908
assistantMessage +
19101909
`\n\n[${
19111910
cancelReason === "streaming_failed"
1912-
? RESPONSE_INTERRUPTED_BY_API_ERROR
1913-
: RESPONSE_INTERRUPTED_BY_USER
1911+
? t("common:interruption.responseInterruptedByApiError")
1912+
: t("common:interruption.responseInterruptedByUser")
19141913
}]`,
19151914
},
19161915
],

src/core/webview/ClineProvider.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ import {
9898
addCancelReasonToLastApiReqStarted,
9999
appendAssistantInterruptionIfNeeded,
100100
} from "../task-persistence/cancelBookkeeping"
101-
import { RESPONSE_INTERRUPTED_BY_USER } from "../../shared/messages"
102101
/**
103102
* https://github.com/microsoft/vscode-webview-ui-toolkit-samples/blob/main/default/weather-webview/src/providers/WeatherViewProvider.ts
104103
* https://github.com/KumarVariable/vscode-extension-sidebar-html/blob/master/src/customSidebarViewProvider.ts
@@ -2616,7 +2615,7 @@ export class ClineProvider
26162615
await appendAssistantInterruptionIfNeeded({
26172616
taskId: task.taskId,
26182617
globalStoragePath: this.contextProxy.globalStorageUri.fsPath,
2619-
text: `[${RESPONSE_INTERRUPTED_BY_USER}]`,
2618+
text: `[${t("common:interruption.responseInterruptedByUser")}]`,
26202619
})
26212620
} catch (e) {
26222621
this.log(`[cancelTask] Cancel bookkeeping failed: ${e instanceof Error ? e.message : String(e)}`)

src/i18n/locales/ca/common.json

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/de/common.json

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/en/common.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,10 @@
161161
"incomplete": "Task #{{taskNumber}} (Incomplete)",
162162
"no_messages": "Task #{{taskNumber}} (No messages)"
163163
},
164+
"interruption": {
165+
"responseInterruptedByUser": "Response interrupted by user",
166+
"responseInterruptedByApiError": "Response interrupted by API error"
167+
},
164168
"storage": {
165169
"prompt_custom_path": "Enter custom conversation history storage path, leave empty to use default location",
166170
"path_placeholder": "D:\\RooCodeStorage",

src/i18n/locales/es/common.json

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/fr/common.json

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/hi/common.json

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/id/common.json

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/it/common.json

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)