Skip to content

Commit 51973df

Browse files
committed
chore(i18n): use t() for tool messages; add generic noChanges/changesRejected; execCommand/fetchInstructions i18n
1 parent ae99055 commit 51973df

File tree

4 files changed

+16
-9
lines changed

4 files changed

+16
-9
lines changed

src/core/tools/executeCommandTool.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ export async function executeCommandTool(
126126

127127
pushToolResult(result)
128128
} else {
129-
pushToolResult(`Command failed to execute in terminal due to a shell integration error.`)
129+
pushToolResult(t("tools:executeCommand.shellIntegrationGenericError"))
130130
}
131131
}
132132

@@ -175,7 +175,7 @@ export async function executeCommand(
175175
try {
176176
await fs.access(workingDir)
177177
} catch (error) {
178-
return [false, `Working directory '${workingDir}' does not exist.`]
178+
return [false, t("tools:executeCommand.workingDirMissing", { workingDir })]
179179
}
180180

181181
let message: { text?: string; images?: string[] } | undefined

src/core/tools/fetchInstructionsTool.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { fetchInstructions } from "../prompts/instructions/instructions"
33
import { ClineSayTool } from "../../shared/ExtensionMessage"
44
import { formatResponse } from "../prompts/responses"
55
import { ToolUse, AskApproval, HandleError, PushToolResult } from "../../shared/tools"
6+
import { t } from "../../i18n"
67

78
export async function fetchInstructionsTool(
89
cline: Task,
@@ -49,7 +50,12 @@ export async function fetchInstructionsTool(
4950
const content = await fetchInstructions(task, { mcpHub, diffStrategy, context })
5051

5152
if (!content) {
52-
pushToolResult(formatResponse.toolError(`Invalid instructions request: ${task}`, "fetch_instructions"))
53+
pushToolResult(
54+
formatResponse.toolError(
55+
t("tools:fetchInstructions.errors.invalidRequest", { defaultValue: "Invalid request" }),
56+
"fetch_instructions",
57+
),
58+
)
5359
return
5460
}
5561

src/core/tools/insertContentTool.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export async function insertContentTool(
131131
// For existing files, generate diff and check for changes
132132
diff = formatResponse.createPrettyPatch(relPath, fileContent, updatedContent)
133133
if (!diff) {
134-
pushToolResult(`No changes needed for '${relPath}'`)
134+
pushToolResult(t("tools:generic.noChanges"))
135135
return
136136
}
137137
approvalContent = undefined
@@ -167,7 +167,7 @@ export async function insertContentTool(
167167
if (!isPreventFocusDisruptionEnabled) {
168168
await cline.diffViewProvider.revertChanges()
169169
}
170-
pushToolResult("Changes were rejected by the user.")
170+
pushToolResult(t("tools:generic.changesRejected"))
171171
await cline.diffViewProvider.reset()
172172
return
173173
}

src/core/tools/searchAndReplaceTool.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { fileExistsAtPath } from "../../utils/fs"
1313
import { RecordSource } from "../context-tracking/FileContextTrackerTypes"
1414
import { DEFAULT_WRITE_DELAY_MS } from "@roo-code/types"
1515
import { EXPERIMENT_IDS, experiments } from "../../shared/experiments"
16+
import { t } from "../../i18n"
1617

1718
/**
1819
* Tool for performing search and replace operations on files
@@ -138,7 +139,7 @@ export async function searchAndReplaceTool(
138139
`File does not exist at path: ${absolutePath}\nThe specified file could not be found. Please verify the file path and try again.`,
139140
)
140141
await cline.say("error", formattedError, undefined, undefined, undefined, undefined, {
141-
title: "File Not Found",
142+
title: t("tools:errors.fileNotFound"),
142143
})
143144
pushToolResult(formattedError)
144145
return
@@ -159,7 +160,7 @@ export async function searchAndReplaceTool(
159160
}\nPlease verify file permissions and try again.`
160161
const formattedError = formatResponse.toolError(errorMessage)
161162
await cline.say("error", formattedError, undefined, undefined, undefined, undefined, {
162-
title: "File Read Error",
163+
title: t("tools:errors.readError"),
163164
})
164165
pushToolResult(formattedError)
165166
return
@@ -199,7 +200,7 @@ export async function searchAndReplaceTool(
199200
// Generate and validate diff
200201
const diff = formatResponse.createPrettyPatch(validRelPath, fileContent, newContent)
201202
if (!diff) {
202-
pushToolResult(`No changes needed for '${relPath}'`)
203+
pushToolResult(t("tools:generic.noChanges"))
203204
await cline.diffViewProvider.reset()
204205
return
205206
}
@@ -236,7 +237,7 @@ export async function searchAndReplaceTool(
236237
if (!isPreventFocusDisruptionEnabled) {
237238
await cline.diffViewProvider.revertChanges()
238239
}
239-
pushToolResult("Changes were rejected by the user.")
240+
pushToolResult(t("tools:generic.changesRejected"))
240241
await cline.diffViewProvider.reset()
241242
return
242243
}

0 commit comments

Comments
 (0)