mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-07 08:26:51 +00:00
fix(embeddings): Translate error messages before sending to UI (#5535)
fix(embeddings): translate error messages before sending to UI - Import t() function from i18n module - Wrap error messages with t() translation function in _initializeEmbedder() - Ensures proper localization of error messages in the UI - Falls back to original message if no translation exists
This commit is contained in:
parent
be1eaa51eb
commit
45f3d88ddf
1 changed files with 11 additions and 6 deletions
|
|
@ -12,6 +12,7 @@ import { CacheManager } from "./cache-manager"
|
|||
import fs from "fs/promises"
|
||||
import ignore from "ignore"
|
||||
import path from "path"
|
||||
import { t } from "../../i18n"
|
||||
|
||||
export class CodeIndexManager {
|
||||
// --- Singleton Implementation ---
|
||||
|
|
@ -261,12 +262,16 @@ export class CodeIndexManager {
|
|||
// Validate embedder configuration before proceeding
|
||||
const validationResult = await this._serviceFactory.validateEmbedder(embedder)
|
||||
if (!validationResult.valid) {
|
||||
// Set error state with clear message
|
||||
this._stateManager.setSystemState(
|
||||
"Error",
|
||||
validationResult.error || "Embedder configuration validation failed",
|
||||
)
|
||||
throw new Error(validationResult.error || "Invalid embedder configuration")
|
||||
const errorMessage = validationResult.error || "Embedder configuration validation failed"
|
||||
// Always attempt translation, use original as fallback
|
||||
let translatedMessage = t(errorMessage)
|
||||
// If translation returns a different value (stripped namespace), use original
|
||||
if (translatedMessage !== errorMessage && !translatedMessage.includes(":")) {
|
||||
translatedMessage = errorMessage
|
||||
}
|
||||
|
||||
this._stateManager.setSystemState("Error", translatedMessage)
|
||||
throw new Error(translatedMessage)
|
||||
}
|
||||
|
||||
// (Re)Initialize orchestrator
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue