diff --git a/ui/goose2/scripts/check-file-sizes.mjs b/ui/goose2/scripts/check-file-sizes.mjs index bc6f75bcba08..49f914a3d74b 100644 --- a/ui/goose2/scripts/check-file-sizes.mjs +++ b/ui/goose2/scripts/check-file-sizes.mjs @@ -30,6 +30,11 @@ const EXCEPTIONS = { justification: "Workspace widget integration tests cover branch switching, worktree creation, dirty-state dialogs, and picker interactions.", }, + "src/features/settings/ui/ModelProviderRow.tsx": { + limit: 515, + justification: + "Multi-line i18n calls for error messages (fieldsMissing interpolation, exhaustive useCallback deps) push marginally past 500. Splitting would create a thin wrapper with no structural benefit.", + }, "src/features/sidebar/ui/Sidebar.tsx": { limit: 580, justification: diff --git a/ui/goose2/src/features/settings/ui/ModelProviderPanels.tsx b/ui/goose2/src/features/settings/ui/ModelProviderPanels.tsx index 05bbdff41378..bb06864644f5 100644 --- a/ui/goose2/src/features/settings/ui/ModelProviderPanels.tsx +++ b/ui/goose2/src/features/settings/ui/ModelProviderPanels.tsx @@ -124,8 +124,8 @@ export function ConnectedFieldsPanel({ className="text-muted-foreground" > {resolveFieldValue(field, fieldValueMap).isSet - ? "Edit" - : "Add"} + ? t("common:actions.edit") + : t("common:actions.add")} )} @@ -287,9 +287,9 @@ export function SetupFieldsPanel({ ([]); const [draftValues, setDraftValues] = useState>({}); @@ -110,7 +110,7 @@ export function ModelProviderRow({ setError( nextError instanceof Error ? nextError.message - : "Failed to load provider settings", + : t("providers.errors.loadFailed"), ); } finally { if (showSkeleton) { @@ -118,7 +118,7 @@ export function ModelProviderRow({ } } }, - [fields, hasFields, onGetConfig, provider.id], + [fields, hasFields, onGetConfig, provider.id, t], ); useEffect(() => { @@ -181,7 +181,7 @@ export function ModelProviderRow({ setSetupError( nextError instanceof Error ? nextError.message - : "Failed to complete sign-in", + : t("providers.errors.signInFailed"), ); } finally { unlisten(); @@ -226,7 +226,7 @@ export function ModelProviderRow({ async function handleSaveField(field: ProviderField) { const nextValue = draftValues[field.key]?.trim() ?? ""; if (!nextValue) { - setError(`Enter a value for ${field.label}`); + setError(t("providers.errors.fieldRequired", { label: field.label })); return; } setError(""); @@ -240,7 +240,9 @@ export function ModelProviderRow({ setShowSavedState(true); } catch (nextError) { setError( - nextError instanceof Error ? nextError.message : "Failed to save", + nextError instanceof Error + ? nextError.message + : t("providers.errors.saveFailed"), ); } } @@ -258,7 +260,11 @@ export function ModelProviderRow({ .map((field) => field.label); if (missingLabels.length > 0) { - setError(`Fill in ${missingLabels.join(", ")}`); + setError( + t("providers.errors.fieldsMissing", { + fields: missingLabels.join(", "), + }), + ); return; } @@ -295,7 +301,9 @@ export function ModelProviderRow({ setShowSavedState(false); } catch (nextError) { setError( - nextError instanceof Error ? nextError.message : "Failed to save", + nextError instanceof Error + ? nextError.message + : t("providers.errors.saveFailed"), ); } } @@ -310,7 +318,9 @@ export function ModelProviderRow({ setShowSavedState(false); } catch (nextError) { setError( - nextError instanceof Error ? nextError.message : "Failed to remove", + nextError instanceof Error + ? nextError.message + : t("providers.errors.removeFailed"), ); } } @@ -369,7 +379,9 @@ export function ModelProviderRow({ {authenticating ? ( ) : null} - {setupError ? "Retry" : "Connect"} + {setupError + ? t("common:actions.retry") + : t("common:actions.connect")} ) : ( diff --git a/ui/goose2/src/shared/i18n/locales/en/common.json b/ui/goose2/src/shared/i18n/locales/en/common.json index 3e4494160a32..a1cccca157be 100644 --- a/ui/goose2/src/shared/i18n/locales/en/common.json +++ b/ui/goose2/src/shared/i18n/locales/en/common.json @@ -20,10 +20,14 @@ "remove": "Remove", "rename": "Rename", "restore": "Restore", + "add": "Add", + "connect": "Connect", "retry": "Retry", "run": "Run", "running": "Running", "save": "Save", + "saved": "Saved", + "saving": "Saving...", "saveChanges": "Save changes", "search": "Search", "select": "Select", diff --git a/ui/goose2/src/shared/i18n/locales/en/settings.json b/ui/goose2/src/shared/i18n/locales/en/settings.json index 93a5aff9f37e..cf2ca01cf209 100644 --- a/ui/goose2/src/shared/i18n/locales/en/settings.json +++ b/ui/goose2/src/shared/i18n/locales/en/settings.json @@ -225,6 +225,14 @@ "title": "Agent harnesses" }, "disconnect": "Disconnect", + "errors": { + "fieldRequired": "Enter a value for {{label}}", + "fieldsMissing": "Fill in {{fields}}", + "loadFailed": "Failed to load provider settings", + "removeFailed": "Failed to remove", + "saveFailed": "Failed to save", + "signInFailed": "Failed to complete sign-in" + }, "models": { "description": "AI models power your agents. Goose requires one to work, but some agents bring their own.", "notSet": "Not set", diff --git a/ui/goose2/src/shared/i18n/locales/es/common.json b/ui/goose2/src/shared/i18n/locales/es/common.json index 074e770b93dd..0eda9d82151f 100644 --- a/ui/goose2/src/shared/i18n/locales/es/common.json +++ b/ui/goose2/src/shared/i18n/locales/es/common.json @@ -20,10 +20,14 @@ "remove": "Quitar", "rename": "Renombrar", "restore": "Restaurar", + "add": "Agregar", + "connect": "Conectar", "retry": "Reintentar", "run": "Ejecutar", "running": "Ejecutando", "save": "Guardar", + "saved": "Guardado", + "saving": "Guardando...", "saveChanges": "Guardar cambios", "search": "Buscar", "select": "Seleccionar", diff --git a/ui/goose2/src/shared/i18n/locales/es/settings.json b/ui/goose2/src/shared/i18n/locales/es/settings.json index 3f2e87aee8e7..93cd5207ac39 100644 --- a/ui/goose2/src/shared/i18n/locales/es/settings.json +++ b/ui/goose2/src/shared/i18n/locales/es/settings.json @@ -225,6 +225,14 @@ "title": "Arneses de agentes" }, "disconnect": "Desconectar", + "errors": { + "fieldRequired": "Ingresa un valor para {{label}}", + "fieldsMissing": "Completa los campos: {{fields}}", + "loadFailed": "No se pudo cargar la configuración del proveedor", + "removeFailed": "Error al eliminar", + "saveFailed": "Error al guardar", + "signInFailed": "No se pudo completar el inicio de sesión" + }, "models": { "description": "Necesitas al menos un proveedor de modelos para usar el agente Goose. Algunos agentes pueden traer sus propias conexiones de modelo.", "notSet": "No configurado",