Skip to content

Commit 3fae369

Browse files
committed
fix: use i18n keys for validation error messages
- Replace hardcoded 'Invalid Ollama URL' and 'Invalid base URL' strings with i18n keys - Add missing invalidOllamaUrl and invalidBaseUrl keys to all locale files - Update tests to expect i18n keys instead of hardcoded strings - Ensures consistent localization across all validation messages
1 parent 808c520 commit 3fae369

File tree

20 files changed

+40
-4
lines changed

20 files changed

+40
-4
lines changed

webview-ui/src/components/chat/CodeIndexPopover.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ const createValidationSchema = (provider: EmbedderProvider, t: any) => {
8989
codebaseIndexEmbedderBaseUrl: z
9090
.string()
9191
.min(1, t("settings:codeIndex.validation.ollamaBaseUrlRequired"))
92-
.url("Invalid Ollama URL"),
92+
.url(t("settings:codeIndex.validation.invalidOllamaUrl")),
9393
codebaseIndexEmbedderModelId: z.string().min(1, t("settings:codeIndex.validation.modelIdRequired")),
9494
})
9595

@@ -98,7 +98,7 @@ const createValidationSchema = (provider: EmbedderProvider, t: any) => {
9898
codebaseIndexOpenAiCompatibleBaseUrl: z
9999
.string()
100100
.min(1, t("settings:codeIndex.validation.baseUrlRequired"))
101-
.url("Invalid base URL"),
101+
.url(t("settings:codeIndex.validation.invalidBaseUrl")),
102102
codebaseIndexOpenAiCompatibleApiKey: z
103103
.string()
104104
.min(1, t("settings:codeIndex.validation.apiKeyRequired")),

webview-ui/src/components/chat/__tests__/CodeIndexPopover.validation.spec.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ describe("CodeIndexPopover Validation", () => {
252252
fireEvent.click(saveButton)
253253

254254
await waitFor(() => {
255-
expect(screen.getByText("Invalid Qdrant URL")).toBeInTheDocument()
255+
expect(screen.getByText("settings:codeIndex.validation.invalidQdrantUrl")).toBeInTheDocument()
256256
})
257257
})
258258

@@ -279,7 +279,7 @@ describe("CodeIndexPopover Validation", () => {
279279
fireEvent.click(saveButton)
280280

281281
await waitFor(() => {
282-
expect(screen.getByText("Invalid Qdrant URL")).toBeInTheDocument()
282+
expect(screen.getByText("settings:codeIndex.validation.invalidQdrantUrl")).toBeInTheDocument()
283283
})
284284
})
285285
})

webview-ui/src/i18n/locales/ca/settings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@
100100
"close": "Tancar",
101101
"validation": {
102102
"invalidQdrantUrl": "URL de Qdrant no vàlida",
103+
"invalidOllamaUrl": "URL d'Ollama no vàlida",
104+
"invalidBaseUrl": "URL de base no vàlida",
103105
"qdrantUrlRequired": "Cal una URL de Qdrant",
104106
"openaiApiKeyRequired": "Cal una clau d'API d'OpenAI",
105107
"modelSelectionRequired": "Cal seleccionar un model",

webview-ui/src/i18n/locales/de/settings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@
100100
"close": "Schließen",
101101
"validation": {
102102
"invalidQdrantUrl": "Ungültige Qdrant-URL",
103+
"invalidOllamaUrl": "Ungültige Ollama-URL",
104+
"invalidBaseUrl": "Ungültige Basis-URL",
103105
"qdrantUrlRequired": "Qdrant-URL ist erforderlich",
104106
"openaiApiKeyRequired": "OpenAI-API-Schlüssel ist erforderlich",
105107
"modelSelectionRequired": "Modellauswahl ist erforderlich",

webview-ui/src/i18n/locales/en/settings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@
108108
"validation": {
109109
"qdrantUrlRequired": "Qdrant URL is required",
110110
"invalidQdrantUrl": "Invalid Qdrant URL",
111+
"invalidOllamaUrl": "Invalid Ollama URL",
112+
"invalidBaseUrl": "Invalid base URL",
111113
"openaiApiKeyRequired": "OpenAI API key is required",
112114
"modelSelectionRequired": "Model selection is required",
113115
"apiKeyRequired": "API key is required",

webview-ui/src/i18n/locales/es/settings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@
100100
"close": "Cerrar",
101101
"validation": {
102102
"invalidQdrantUrl": "URL de Qdrant no válida",
103+
"invalidOllamaUrl": "URL de Ollama no válida",
104+
"invalidBaseUrl": "URL base no válida",
103105
"qdrantUrlRequired": "Se requiere la URL de Qdrant",
104106
"openaiApiKeyRequired": "Se requiere la clave API de OpenAI",
105107
"modelSelectionRequired": "Se requiere la selección de un modelo",

webview-ui/src/i18n/locales/fr/settings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@
100100
"close": "Fermer",
101101
"validation": {
102102
"invalidQdrantUrl": "URL Qdrant invalide",
103+
"invalidOllamaUrl": "URL Ollama invalide",
104+
"invalidBaseUrl": "URL de base invalide",
103105
"qdrantUrlRequired": "L'URL Qdrant est requise",
104106
"openaiApiKeyRequired": "La clé API OpenAI est requise",
105107
"modelSelectionRequired": "La sélection du modèle est requise",

webview-ui/src/i18n/locales/hi/settings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@
100100
"close": "बंद करें",
101101
"validation": {
102102
"invalidQdrantUrl": "अमान्य Qdrant URL",
103+
"invalidOllamaUrl": "अमान्य Ollama URL",
104+
"invalidBaseUrl": "अमान्य बेस URL",
103105
"qdrantUrlRequired": "Qdrant URL आवश्यक है",
104106
"openaiApiKeyRequired": "OpenAI API कुंजी आवश्यक है",
105107
"modelSelectionRequired": "मॉडल चयन आवश्यक है",

webview-ui/src/i18n/locales/id/settings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@
100100
"close": "Tutup",
101101
"validation": {
102102
"invalidQdrantUrl": "URL Qdrant tidak valid",
103+
"invalidOllamaUrl": "URL Ollama tidak valid",
104+
"invalidBaseUrl": "URL dasar tidak valid",
103105
"qdrantUrlRequired": "URL Qdrant diperlukan",
104106
"openaiApiKeyRequired": "Kunci API OpenAI diperlukan",
105107
"modelSelectionRequired": "Pemilihan model diperlukan",

webview-ui/src/i18n/locales/it/settings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@
100100
"close": "Chiudi",
101101
"validation": {
102102
"invalidQdrantUrl": "URL Qdrant non valido",
103+
"invalidOllamaUrl": "URL Ollama non valido",
104+
"invalidBaseUrl": "URL di base non valido",
103105
"qdrantUrlRequired": "È richiesto l'URL di Qdrant",
104106
"openaiApiKeyRequired": "È richiesta la chiave API di OpenAI",
105107
"modelSelectionRequired": "È richiesta la selezione del modello",

0 commit comments

Comments
 (0)