🙌 OpenHands: AI-Driven Development
fix: require I18nKey for translation calls (#1230)
Ismail Zalimc5f793acc769
diff --git a/eslint.config.js b/eslint.config.jsindex 2c179563d8..125c64bf47 100644--- a/eslint.config.js+++ b/eslint.config.js@@ -242,6 +242,16 @@ export default [message:"Use SETTINGS_QUERY_KEYS helpers instead of raw settings query key arrays.",},+ {+ selector:+ "CallExpression[callee.name='t'] > Literal:first-child[value=/^[A-Z0-9_]+\\$/]",+ message: "Use I18nKey instead of raw translation key strings.",+ },+ {+ selector:+ "CallExpression[callee.property.name='t'] > Literal:first-child[value=/^[A-Z0-9_]+\\$/]",+ message: "Use I18nKey instead of raw translation key strings.",+ },],"react/require-default-props": "off","no-underscore-dangle": "off",diff --git a/src/components/conversation-events/chat/event-content-helpers/get-acp-tool-call-content.ts b/src/components/conversation-events/chat/event-content-helpers/get-acp-tool-call-content.tsindex c059872583..b53c07bebe 100644--- a/src/components/conversation-events/chat/event-content-helpers/get-acp-tool-call-content.ts+++ b/src/components/conversation-events/chat/event-content-helpers/get-acp-tool-call-content.ts@@ -1,6 +1,7 @@import { ACPToolCallEvent } from "#/types/agent-server/core/events/acp-tool-call-event";import i18n from "#/i18n";import { MAX_CONTENT_LENGTH } from "./shared";+import { I18nKey } from "#/i18n/declaration";/*** Pick the translation key used for the ACP tool call title row. Mirrors@@ -124,7 +125,7 @@ export const getACPToolCallContent = (event: ACPToolCallEvent): string => {// Output block — matches the bash observation layout exactly.const outputStr = truncate(stringifyPayload(rawOutput).trim());const outputLabel = isError ? "**Error:**" : "Output:";- const outputBody = outputStr || i18n.t("OBSERVATION$COMMAND_NO_OUTPUT");+ const outputBody = outputStr || i18n.t(I18nKey.OBSERVATION$COMMAND_NO_OUTPUT);output += `${outputLabel}\n\`\`\`\n${outputBody}\n\`\`\``;return output;diff --git a/src/components/conversation-events/chat/event-content-helpers/get-action-content.ts b/src/components/conversation-events/chat/event-content-helpers/get-action-content.tsindex 375f3e5b97..0feaf47b77 100644--- a/src/components/conversation-events/chat/event-content-helpers/get-action-content.ts+++ b/src/components/conversation-events/chat/event-content-helpers/get-action-content.ts@@ -2,6 +2,7 @@ import { ActionEvent } from "#/types/agent-server/core";import { getDefaultEventContent, MAX_CONTENT_LENGTH } from "./shared";import i18n from "#/i18n";import { SecurityRisk } from "#/types/agent-server/core/base/common";+import { I18nKey } from "#/i18n/declaration";import {ExecuteBashAction,TerminalAction,@@ -29,14 +30,14 @@ import {const getRiskText = (risk: SecurityRisk) => {switch (risk) {case SecurityRisk.LOW:- return i18n.t("SECURITY$LOW_RISK");+ return i18n.t(I18nKey.SECURITY$LOW_RISK);case SecurityRisk.MEDIUM:- return i18n.t("SECURITY$MEDIUM_RISK");+ return i18n.t(I18nKey.SECURITY$MEDIUM_RISK);case SecurityRisk.HIGH:- return i18n.t("SECURITY$HIGH_RISK");+ return i18n.t(I18nKey.SECURITY$HIGH_RISK);case SecurityRisk.UNKNOWN:default:- return i18n.t("SECURITY$UNKNOWN_RISK");+ return i18n.t(I18nKey.SECURITY$UNKNOWN_RISK);}};diff --git a/src/components/conversation-events/chat/event-content-helpers/get-event-content.tsx b/src/components/conversation-events/chat/event-content-helpers/get-event-content.tsxindex 51cf2ad134..8aee37b3ae 100644--- a/src/components/conversation-events/chat/event-content-helpers/get-event-content.tsx+++ b/src/components/conversation-events/chat/event-content-helpers/get-event-content.tsx@@ -23,6 +23,7 @@ import { TaskTrackingObservationContent } from "../task-tracking/task-tracking-oimport { TaskTrackerObservation } from "#/types/agent-server/core/base/observation";import { SkillReadyEvent, isSkillReadyEvent } from "./create-skill-ready-event";import i18n from "#/i18n";+import { I18nKey } from "#/i18n/declaration";const trimText = (text: string, maxLength: number): string => {if (!text) return "";@@ -340,7 +341,7 @@ export const getEventContent = (}return {- title: title || i18n.t("EVENT$UNKNOWN_EVENT"),+ title: title || i18n.t(I18nKey.EVENT$UNKNOWN_EVENT),details,};};diff --git a/src/components/conversation-events/chat/event-content-helpers/get-observation-content.ts b/src/components/conversation-events/chat/event-content-helpers/get-observation-content.tsindex 74c1162ae5..dd6ddaa190 100644--- a/src/components/conversation-events/chat/event-content-helpers/get-observation-content.ts+++ b/src/components/conversation-events/chat/event-content-helpers/get-observation-content.ts@@ -2,6 +2,7 @@ import { ObservationEvent } from "#/types/agent-server/core";import { getObservationResult } from "./get-observation-result";import { getDefaultEventContent, MAX_CONTENT_LENGTH } from "./shared";import i18n from "#/i18n";+import { I18nKey } from "#/i18n/declaration";import {MCPToolObservation,FinishObservation,@@ -84,7 +85,7 @@ const getTerminalObservationContent = (}// Display the output- output += `Output:\n\`\`\`sh\n${content.trim() || i18n.t("OBSERVATION$COMMAND_NO_OUTPUT")}\n\`\`\``;+ output += `Output:\n\`\`\`sh\n${content.trim() || i18n.t(I18nKey.OBSERVATION$COMMAND_NO_OUTPUT)}\n\`\`\``;return output;};diff --git a/src/components/conversation-events/chat/event-content-helpers/parse-message-from-event.ts b/src/components/conversation-events/chat/event-content-helpers/parse-message-from-event.tsindex 645dbb21fd..bc6301c922 100644--- a/src/components/conversation-events/chat/event-content-helpers/parse-message-from-event.ts+++ b/src/components/conversation-events/chat/event-content-helpers/parse-message-from-event.ts@@ -1,5 +1,6 @@import { MessageEvent } from "#/types/agent-server/core";import i18n from "#/i18n";+import { I18nKey } from "#/i18n/declaration";export const parseMessageFromEvent = (event: MessageEvent): string => {const message = event.llm_message;@@ -34,7 +35,7 @@ export const parseMessageFromEvent = (event: MessageEvent): string => {}// If there are images, try to split by the augmented prompt delimiter- const delimiter = i18n.t("CHAT_INTERFACE$AUGMENTED_PROMPT_FILES_TITLE");+ const delimiter = i18n.t(I18nKey.CHAT_INTERFACE$AUGMENTED_PROMPT_FILES_TITLE);const parts = textContent.split(delimiter);return parts[0];diff --git a/src/components/features/chat/chat-interface.tsx b/src/components/features/chat/chat-interface.tsxindex 41b4c667b0..c495847a76 100644--- a/src/components/features/chat/chat-interface.tsx+++ b/src/components/features/chat/chat-interface.tsx@@ -329,7 +329,7 @@ export function ChatInterface() {skippedFiles.forEach((f) => displayErrorToast(f.reason));- const filePrompt = `${t("CHAT_INTERFACE$AUGMENTED_PROMPT_FILES_TITLE")}: ${uploadedFiles.join("\n\n")}`;+ const filePrompt = `${t(I18nKey.CHAT_INTERFACE$AUGMENTED_PROMPT_FILES_TITLE)}: ${uploadedFiles.join("\n\n")}`;const prompt =uploadedFiles.length > 0 ? `${content}\n\n${filePrompt}` : content;diff --git a/src/components/features/chat/components/slash-command-menu.tsx b/src/components/features/chat/components/slash-command-menu.tsxindex adbc053aff..29b3af7847 100644--- a/src/components/features/chat/components/slash-command-menu.tsx+++ b/src/components/features/chat/components/slash-command-menu.tsx@@ -7,6 +7,7 @@ import {} from "#/utils/dropdown-classes";import { Text } from "#/ui/typography";import { SlashCommandItem } from "#/hooks/chat/use-slash-command";+import { I18nKey } from "#/i18n/declaration";/*** Strip common inline Markdown syntax so descriptions render as plain text.@@ -157,12 +158,12 @@ export function SlashCommandMenu({return (<divrole="listbox"- aria-label={t("CHAT_INTERFACE$COMMANDS")}+ aria-label={t(I18nKey.CHAT_INTERFACE$COMMANDS)}className="absolute bottom-full left-0 w-full mb-1 bg-[var(--oh-surface)] border border-[var(--oh-border-subtle)] rounded-lg shadow-lg max-h-[300px] overflow-y-auto custom-scrollbar z-50"data-testid="slash-command-menu"><div className="px-3 py-2 text-xs text-[var(--oh-muted)] border-b border-[var(--oh-border-subtle)]">- {t("CHAT_INTERFACE$COMMANDS")}+ {t(I18nKey.CHAT_INTERFACE$COMMANDS)}</div><div className={dropdownMenuListClassName}>{items.map((item, index) => (diff --git a/src/components/features/chat/waiting-for-runtime-message.tsx b/src/components/features/chat/waiting-for-runtime-message.tsxindex b44f2912c5..fdf1fcf844 100644--- a/src/components/features/chat/waiting-for-runtime-message.tsx+++ b/src/components/features/chat/waiting-for-runtime-message.tsx@@ -1,5 +1,6 @@import { useTranslation } from "react-i18next";import { cn } from "#/utils/utils";+import { I18nKey } from "#/i18n/declaration";interface WaitingForRuntimeMessageProps {className?: string;@@ -20,7 +21,7 @@ export function WaitingForRuntimeMessage({className,)}>- {t("DIFF_VIEWER$WAITING_FOR_RUNTIME")}+ {t(I18nKey.DIFF_VIEWER$WAITING_FOR_RUNTIME)}</div>);}diff --git a/src/components/features/conversation-panel/system-message-modal/empty-tools-state.tsx b/src/components/features/conversation-panel/system-message-modal/empty-tools-state.tsxindex b44247076f..f0177a9000 100644--- a/src/components/features/conversation-panel/system-message-modal/empty-tools-state.tsx+++ b/src/components/features/conversation-panel/system-message-modal/empty-tools-state.tsx@@ -1,5 +1,6 @@import { useTranslation } from "react-i18next";import { Typography } from "#/ui/typography";+import { I18nKey } from "#/i18n/declaration";export function EmptyToolsState() {const { t } = useTranslation("openhands");@@ -7,7 +8,7 @@ export function EmptyToolsState() {return (<div className="flex items-center justify-center h-full p-4"><Typography.Text className="text-[var(--oh-muted)]">- {t("SYSTEM_MESSAGE_MODAL$NO_TOOLS")}+ {t(I18nKey.SYSTEM_MESSAGE_MODAL$NO_TOOLS)}</Typography.Text></div>);diff --git a/src/components/features/conversation-panel/system-message-modal/tab-navigation.tsx b/src/components/features/conversation-panel/system-message-modal/tab-navigation.tsxindex c8522b1381..d2820298f4 100644--- a/src/components/features/conversation-panel/system-message-modal/tab-navigation.tsx+++ b/src/components/features/conversation-panel/system-message-modal/tab-navigation.tsx@@ -1,5 +1,6 @@import { useTranslation } from "react-i18next";import { TabButton } from "./tab-button";+import { I18nKey } from "#/i18n/declaration";interface TabNavigationProps {activeTab: "system" | "tools";@@ -23,14 +24,14 @@ export function TabNavigation({isActive={activeTab === "system"}onClick={() => onTabChange("system")}>- {t("SYSTEM_MESSAGE_MODAL$SYSTEM_MESSAGE_TAB")}+ {t(I18nKey.SYSTEM_MESSAGE_MODAL$SYSTEM_MESSAGE_TAB)}</TabButton>{hasTools && (<TabButtonisActive={activeTab === "tools"}onClick={() => onTabChange("tools")}>- {t("SYSTEM_MESSAGE_MODAL$TOOLS_TAB")}+ {t(I18nKey.SYSTEM_MESSAGE_MODAL$TOOLS_TAB)}</TabButton>)}</div>diff --git a/src/components/features/conversation-panel/system-message-modal/tool-parameters.tsx b/src/components/features/conversation-panel/system-message-modal/tool-parameters.tsxindex a89996d7ec..9bb4081632 100644--- a/src/components/features/conversation-panel/system-message-modal/tool-parameters.tsx+++ b/src/components/features/conversation-panel/system-message-modal/tool-parameters.tsx@@ -2,6 +2,7 @@ import { useTranslation } from "react-i18next";import ReactJsonView from "@microlink/react-json-view";import { JSON_VIEW_THEME } from "#/utils/constants";import { Typography } from "#/ui/typography";+import { I18nKey } from "#/i18n/declaration";interface ToolParametersProps {parameters: Record<string, unknown>;@@ -13,7 +14,7 @@ export function ToolParameters({ parameters }: ToolParametersProps) {return (<div className="mt-2" data-testid="tool-parameters"><Typography.Text className="text-sm font-semibold text-[var(--oh-text-tertiary)]">- {t("SYSTEM_MESSAGE_MODAL$PARAMETERS")}+ {t(I18nKey.SYSTEM_MESSAGE_MODAL$PARAMETERS)}</Typography.Text><div className="text-sm mt-2 p-3 bg-base rounded-md overflow-auto text-[var(--oh-text-tertiary)] max-h-[400px] border border-[var(--oh-border)]"><ReactJsonView name={false} src={parameters} theme={JSON_VIEW_THEME} />diff --git a/src/components/features/home/home-header/guide-message.tsx b/src/components/features/home/home-header/guide-message.tsxindex 4549a9abcf..2180225ad0 100644--- a/src/components/features/home/home-header/guide-message.tsx+++ b/src/components/features/home/home-header/guide-message.tsx@@ -1,17 +1,18 @@import { useTranslation } from "react-i18next";+import { I18nKey } from "#/i18n/declaration";export function GuideMessage() {const { t } = useTranslation("openhands");return (<div className="w-fit flex flex-col md:flex-row items-start md:items-center justify-center gap-1 rounded-[12px] bg-tertiary leading-5 text-white text-[15px] font-normal m-1 md:h-9.5 px-4 pb-1 md:px-[15px] md:py-0">- <span className="">{t("HOME$GUIDE_MESSAGE_TITLE")} </span>+ <span className="">{t(I18nKey.HOME$GUIDE_MESSAGE_TITLE)} </span><ahref="https://docs.all-hands.dev/usage/getting-started"target="_blank"rel="noopener noreferrer">- <span className="underline">{t("COMMON$CLICK_HERE")}</span>+ <span className="underline">{t(I18nKey.COMMON$CLICK_HERE)}</span></a></div>);diff --git a/src/components/features/home/home-header/home-header-title.tsx b/src/components/features/home/home-header/home-header-title.tsxindex db840d5569..58cc14f805 100644--- a/src/components/features/home/home-header/home-header-title.tsx+++ b/src/components/features/home/home-header/home-header-title.tsx@@ -1,5 +1,6 @@import { useTranslation } from "react-i18next";import { Typography } from "#/ui/typography";+import { I18nKey } from "#/i18n/declaration";export function HomeHeaderTitle() {const { t } = useTranslation("openhands");@@ -7,7 +8,7 @@ export function HomeHeaderTitle() {return (<div className="flex min-h-[80px] w-full items-center justify-center py-2"><Typography.H1 className="w-full text-center leading-normal">- {t("HOME$LETS_START_BUILDING")}+ {t(I18nKey.HOME$LETS_START_BUILDING)}</Typography.H1></div>);diff --git a/src/components/features/home/new-conversation.tsx b/src/components/features/home/new-conversation.tsxindex 767483e8ac..55a4a43175 100644--- a/src/components/features/home/new-conversation.tsx+++ b/src/components/features/home/new-conversation.tsx@@ -53,8 +53,8 @@ export function NewConversation() {isDisabled={isCreatingConversation}className="w-auto absolute bottom-5 left-5 right-5">- {!isCreatingConversation && t("COMMON$NEW_CONVERSATION")}- {isCreatingConversation && t("HOME$LOADING")}+ {!isCreatingConversation && t(I18nKey.COMMON$NEW_CONVERSATION)}+ {isCreatingConversation && t(I18nKey.HOME$LOADING)}</BrandButton></section>);diff --git a/src/components/features/home/new-conversation/create-conversation-button.tsx b/src/components/features/home/new-conversation/create-conversation-button.tsxindex 1a26f3e356..ef654dea59 100644--- a/src/components/features/home/new-conversation/create-conversation-button.tsx+++ b/src/components/features/home/new-conversation/create-conversation-button.tsx@@ -3,6 +3,7 @@ import { BrandButton } from "../../settings/brand-button";import { useNavigation } from "#/context/navigation-context";import { useCreateConversation } from "#/hooks/mutation/use-create-conversation";import { useIsCreatingConversation } from "#/hooks/use-is-creating-conversation";+import { I18nKey } from "#/i18n/declaration";export function CreateConversationButton() {const { t } = useTranslation("openhands");@@ -38,8 +39,8 @@ export function CreateConversationButton() {isDisabled={isCreatingConversation}className="w-auto absolute bottom-5 left-5 right-5">- {!isCreatingConversation && t("COMMON$NEW_CONVERSATION")}- {isCreatingConversation && t("HOME$LOADING")}+ {!isCreatingConversation && t(I18nKey.COMMON$NEW_CONVERSATION)}+ {isCreatingConversation && t(I18nKey.HOME$LOADING)}</BrandButton>);}diff --git a/src/components/features/home/repo-selection-form.tsx b/src/components/features/home/repo-selection-form.tsxindex 1074827c59..93e415b4bd 100644--- a/src/components/features/home/repo-selection-form.tsx+++ b/src/components/features/home/repo-selection-form.tsx@@ -246,7 +246,7 @@ export function RepositorySelectionForm({? t(I18nKey.BUTTON$CONFIRM): !isCreatingConversation? "Launch"- : t("HOME$LOADING")}+ : t(I18nKey.HOME$LOADING)}</BrandButton></div>);diff --git a/src/components/features/home/repository-selection/branch-error-state.tsx b/src/components/features/home/repository-selection/branch-error-state.tsxindex 23d10128a6..87a569d00b 100644--- a/src/components/features/home/repository-selection/branch-error-state.tsx+++ b/src/components/features/home/repository-selection/branch-error-state.tsx@@ -1,6 +1,7 @@import { useTranslation } from "react-i18next";import { cn } from "#/utils/utils";import { formControlFieldClassName } from "#/utils/form-control-classes";+import { I18nKey } from "#/i18n/declaration";interface BranchErrorStateProps {wrapperClassName?: string;@@ -17,7 +18,7 @@ export function BranchErrorState({ wrapperClassName }: BranchErrorStateProps) {wrapperClassName,)}>- <span className="text-sm">{t("HOME$FAILED_TO_LOAD_BRANCHES")}</span>+ <span className="text-sm">{t(I18nKey.HOME$FAILED_TO_LOAD_BRANCHES)}</span></div>);}diff --git a/src/components/features/home/repository-selection/branch-loading-state.tsx b/src/components/features/home/repository-selection/branch-loading-state.tsxindex ed998d70d0..9ecd3809c3 100644--- a/src/components/features/home/repository-selection/branch-loading-state.tsx+++ b/src/components/features/home/repository-selection/branch-loading-state.tsx@@ -2,6 +2,7 @@ import { useTranslation } from "react-i18next";import { Spinner } from "@heroui/react";import { cn } from "#/utils/utils";import { formControlFieldClassName } from "#/utils/form-control-classes";+import { I18nKey } from "#/i18n/declaration";interface BranchLoadingStateProps {wrapperClassName?: string;@@ -21,7 +22,7 @@ export function BranchLoadingState({)}><Spinner size="sm" />- <span className="text-sm">{t("HOME$LOADING_BRANCHES")}</span>+ <span className="text-sm">{t(I18nKey.HOME$LOADING_BRANCHES)}</span></div>);}diff --git a/src/components/features/home/repository-selection/repository-error-state.tsx b/src/components/features/home/repository-selection/repository-error-state.tsxindex 90159d284c..ad0c22e59f 100644--- a/src/components/features/home/repository-selection/repository-error-state.tsx+++ b/src/components/features/home/repository-selection/repository-error-state.tsx@@ -1,6 +1,7 @@import { useTranslation } from "react-i18next";import { cn } from "#/utils/utils";import { formControlFieldClassName } from "#/utils/form-control-classes";+import { I18nKey } from "#/i18n/declaration";export interface RepositoryErrorStateProps {wrapperClassName?: string;@@ -19,7 +20,9 @@ export function RepositoryErrorState({wrapperClassName,)}>- <span className="text-sm">{t("HOME$FAILED_TO_LOAD_REPOSITORIES")}</span>+ <span className="text-sm">+ {t(I18nKey.HOME$FAILED_TO_LOAD_REPOSITORIES)}+ </span></div>);}diff --git a/src/components/features/home/repository-selection/repository-loading-state.tsx b/src/components/features/home/repository-selection/repository-loading-state.tsxindex 5104669323..91e8d3da02 100644--- a/src/components/features/home/repository-selection/repository-loading-state.tsx+++ b/src/components/features/home/repository-selection/repository-loading-state.tsx@@ -2,6 +2,7 @@ import { useTranslation } from "react-i18next";import { Spinner } from "@heroui/react";import { cn } from "#/utils/utils";import { formControlFieldClassName } from "#/utils/form-control-classes";+import { I18nKey } from "#/i18n/declaration";export interface RepositoryLoadingStateProps {wrapperClassName?: string;@@ -21,7 +22,7 @@ export function RepositoryLoadingState({)}><Spinner size="sm" />- <span className="text-sm">{t("HOME$LOADING_REPOSITORIES")}</span>+ <span className="text-sm">{t(I18nKey.HOME$LOADING_REPOSITORIES)}</span></div>);}diff --git a/src/components/features/home/tasks/task-card.tsx b/src/components/features/home/tasks/task-card.tsxindex e6aa8ac590..59a7687bf3 100644--- a/src/components/features/home/tasks/task-card.tsx+++ b/src/components/features/home/tasks/task-card.tsx@@ -6,14 +6,15 @@ import { TaskIssueNumber } from "./task-issue-number";import { useOptimisticUserMessageStore } from "#/stores/optimistic-user-message-store";import { useNavigation } from "#/context/navigation-context";import { cn } from "#/utils/utils";+import { I18nKey } from "#/i18n/declaration";const getTaskTypeMap = (t: (key: string) => string,): Record<SuggestedTask["task_type"], string> => ({- FAILING_CHECKS: t("HOME$FIX_FAILING_CHECKS"),- MERGE_CONFLICTS: t("HOME$RESOLVE_MERGE_CONFLICTS"),- OPEN_ISSUE: t("HOME$OPEN_ISSUE"),- UNRESOLVED_COMMENTS: t("HOME$RESOLVE_UNRESOLVED_COMMENTS"),+ FAILING_CHECKS: t(I18nKey.HOME$FIX_FAILING_CHECKS),+ MERGE_CONFLICTS: t(I18nKey.HOME$RESOLVE_MERGE_CONFLICTS),+ OPEN_ISSUE: t(I18nKey.HOME$OPEN_ISSUE),+ UNRESOLVED_COMMENTS: t(I18nKey.HOME$RESOLVE_UNRESOLVED_COMMENTS),});interface TaskCardProps {@@ -46,7 +47,7 @@ export function TaskCard({ task }: TaskCardProps) {// looking at when they clicked the task).enqueuePendingMessage({conversationId: data.conversation_id,- text: t("TASK$ADDRESSING_TASK"),+ text: t(I18nKey.TASK$ADDRESSING_TASK),});navigate(`/conversations/${data.conversation_id}`);},diff --git a/src/components/features/settings/agent-server-onboarding.tsx b/src/components/features/settings/agent-server-onboarding.tsxindex 2815ecb881..8f485d00e0 100644--- a/src/components/features/settings/agent-server-onboarding.tsx+++ b/src/components/features/settings/agent-server-onboarding.tsx@@ -14,6 +14,7 @@ import type { Backend } from "#/api/backend-registry/types";import { cn } from "#/utils/utils";import { BrandButton } from "./brand-button";import { SettingsInput } from "./settings-input";+import { I18nKey } from "#/i18n/declaration";type AgentServerConnectionFormVariant = "settings" | "onboarding";@@ -102,10 +103,10 @@ export function AgentServerConnectionForm({{shouldShowSectionHeader ? (<div><p className="text-sm font-medium uppercase tracking-[0.24em] text-primary">- {t("SETTINGS$AGENT_SERVER_CONNECTION_DETAILS_TITLE")}+ {t(I18nKey.SETTINGS$AGENT_SERVER_CONNECTION_DETAILS_TITLE)}</p><p className="mt-3 w-full min-w-0 text-sm leading-7 text-[var(--oh-muted)]">- {t("SETTINGS$AGENT_SERVER_CONNECTION_DETAILS_DESCRIPTION")}+ {t(I18nKey.SETTINGS$AGENT_SERVER_CONNECTION_DETAILS_DESCRIPTION)}</p></div>) : null}@@ -114,10 +115,10 @@ export function AgentServerConnectionForm({testId="agent-server-url-input"name="agent-server-url-input"type="text"- label={t("SETTINGS$AGENT_SERVER_URL")}+ label={t(I18nKey.SETTINGS$AGENT_SERVER_URL)}value={baseUrl}onChange={setBaseUrl}- placeholder={t("SETTINGS$AGENT_SERVER_URL_PLACEHOLDER")}+ placeholder={t(I18nKey.SETTINGS$AGENT_SERVER_URL_PLACEHOLDER)}className="w-full min-w-0"/>@@ -125,16 +126,16 @@ export function AgentServerConnectionForm({testId="agent-server-api-key-input"name="agent-server-api-key-input"type="password"- label={t("SETTINGS$AGENT_SERVER_API_KEY")}+ label={t(I18nKey.SETTINGS$AGENT_SERVER_API_KEY)}value={sessionApiKey}onChange={setSessionApiKey}- placeholder={t("SETTINGS$AGENT_SERVER_API_KEY_PLACEHOLDER")}+ placeholder={t(I18nKey.SETTINGS$AGENT_SERVER_API_KEY_PLACEHOLDER)}showOptionalTagclassName="w-full min-w-0"/><p className="w-full min-w-0 text-xs leading-6 text-[var(--oh-text-subtle)]">- {t("SETTINGS$AGENT_SERVER_BROWSER_ONLY_NOTE")}+ {t(I18nKey.SETTINGS$AGENT_SERVER_BROWSER_ONLY_NOTE)}</p></div>@@ -146,7 +147,7 @@ export function AgentServerConnectionForm({onClick={reconnect}startContent={<RefreshCw className="size-4" />}>- {t("SETTINGS$AGENT_SERVER_RETRY_CONNECTION")}+ {t(I18nKey.SETTINGS$AGENT_SERVER_RETRY_CONNECTION)}</BrandButton><BrandButtontestId="submit-button"@@ -154,7 +155,7 @@ export function AgentServerConnectionForm({type="submit"isDisabled={formIsClean}>- {t("SETTINGS$SAVE_AND_RECONNECT")}+ {t(I18nKey.SETTINGS$SAVE_AND_RECONNECT)}</BrandButton></div></form>diff --git a/src/components/features/settings/secrets-settings/secret-form.tsx b/src/components/features/settings/secrets-settings/secret-form.tsxindex 6cffc4ff65..f546651efe 100644--- a/src/components/features/settings/secrets-settings/secret-form.tsx+++ b/src/components/features/settings/secrets-settings/secret-form.tsx@@ -94,13 +94,13 @@ export function SecretForm({(secret) => secret.name === name && secret.name !== selectedSecret,);if (isNameAlreadyUsed) {- setError(t("SECRETS$SECRET_ALREADY_EXISTS"));+ setError(t(I18nKey.SECRETS$SECRET_ALREADY_EXISTS));return;}if (mode === "add") {if (!value) {- setError(t("SECRETS$SECRET_VALUE_REQUIRED"));+ setError(t(I18nKey.SECRETS$SECRET_VALUE_REQUIRED));return;}@@ -127,7 +127,7 @@ export function SecretForm({className="w-full min-w-0"requireddefaultValue={mode === "edit" && selectedSecret ? selectedSecret : ""}- placeholder={t("SECRETS$API_KEY_EXAMPLE")}+ placeholder={t(I18nKey.SECRETS$API_KEY_EXAMPLE)}pattern="^[a-zA-Z][a-zA-Z0-9_]{0,63}$"title="Must start with a letter, contain only letters/numbers/underscores, and be 1-64 characters"/>@@ -177,8 +177,8 @@ export function SecretForm({{t(I18nKey.BUTTON$CANCEL)}</BrandButton><BrandButton testId="submit-button" type="submit" variant="primary">- {mode === "add" && t("SECRETS$ADD_SECRET")}- {mode === "edit" && t("SECRETS$EDIT_SECRET")}+ {mode === "add" && t(I18nKey.SECRETS$ADD_SECRET)}+ {mode === "edit" && t(I18nKey.SECRETS$EDIT_SECRET)}</BrandButton></div></form>diff --git a/src/components/features/settings/settings-dropdown-input.tsx b/src/components/features/settings/settings-dropdown-input.tsxindex 6036278057..a6f12a6820 100644--- a/src/components/features/settings/settings-dropdown-input.tsx+++ b/src/components/features/settings/settings-dropdown-input.tsx@@ -5,6 +5,7 @@ import { OptionalTag } from "./optional-tag";import { cn } from "#/utils/utils";import { formControlSettingsFieldClassName } from "#/utils/form-control-classes";import { heroUiAutocompleteSelectorButtonClassName } from "#/ui/combobox-caret";+import { I18nKey } from "#/i18n/declaration";interface SettingsDropdownInputProps {testId: string;@@ -75,7 +76,7 @@ export function SettingsDropdownInput({isClearable={isClearable}isDisabled={isDisabled || isLoading}isLoading={isLoading}- placeholder={isLoading ? t("HOME$LOADING") : placeholder}+ placeholder={isLoading ? t(I18nKey.HOME$LOADING) : placeholder}allowsCustomValue={allowsCustomValue}isRequired={required}className="w-full"diff --git a/src/components/features/settings/upgrade-button.tsx b/src/components/features/settings/upgrade-button.tsxindex e0bb54a030..92792693f5 100644--- a/src/components/features/settings/upgrade-button.tsx+++ b/src/components/features/settings/upgrade-button.tsx@@ -1,5 +1,6 @@import { useTranslation } from "react-i18next";import { cn } from "#/utils/utils";+import { I18nKey } from "#/i18n/declaration";interface UpgradeButtonProps {onClick?: () => void;@@ -24,7 +25,7 @@ export function UpgradeButton({className,)}>- {t("SETTINGS$UPGRADE_BUTTON")}+ {t(I18nKey.SETTINGS$UPGRADE_BUTTON)}</button>);}diff --git a/src/components/shared/hook-execution-event-message.tsx b/src/components/shared/hook-execution-event-message.tsxindex 6b4793e02f..2b71f2cbac 100644--- a/src/components/shared/hook-execution-event-message.tsx+++ b/src/components/shared/hook-execution-event-message.tsx@@ -4,6 +4,7 @@ import { isHookExecutionEvent } from "#/types/agent-server/type-guards";import { OpenHandsEvent } from "#/types/agent-server/core";import { GenericEventMessage } from "#/components/features/chat/generic-event-message";import { cn } from "#/utils/utils";+import { I18nKey } from "#/i18n/declaration";interface HookExecutionEventMessageProps {event: OpenHandsEvent;@@ -76,7 +77,7 @@ export function HookExecutionEventMessage({const title = (<span>- {icon} {t("HOOK$HOOK_LABEL")}: {event.hook_event_type}+ {icon} {t(I18nKey.HOOK$HOOK_LABEL)}: {event.hook_event_type}{event.tool_name && (<span className="text-[var(--oh-muted)] ml-2">({event.tool_name})</span>)}@@ -90,7 +91,7 @@ export function HookExecutionEventMessage({<div className="flex flex-col gap-2 text-[var(--oh-muted)]"><div><span className="text-[var(--oh-text-subtle)]">- {t("HOOK$COMMAND")}:+ {t(I18nKey.HOOK$COMMAND)}:</span>{" "}<code className="text-xs bg-[var(--oh-surface)] px-1 py-0.5 rounded">{formatHookCommand(event.hook_command)}@@ -100,7 +101,7 @@ export function HookExecutionEventMessage({{event.exit_code !== null && (<div><span className="text-[var(--oh-text-subtle)]">- {t("HOOK$EXIT_CODE")}:+ {t(I18nKey.HOOK$EXIT_CODE)}:</span>{" "}{event.exit_code}</div>@@ -109,7 +110,7 @@ export function HookExecutionEventMessage({{event.blocked && event.reason && (<div className="text-amber-400"><span className="text-[var(--oh-text-subtle)]">- {t("HOOK$BLOCKED_REASON")}:+ {t(I18nKey.HOOK$BLOCKED_REASON)}:</span>{" "}{event.reason}</div>@@ -118,7 +119,7 @@ export function HookExecutionEventMessage({{event.additional_context && (<div><span className="text-[var(--oh-text-subtle)]">- {t("HOOK$CONTEXT")}:+ {t(I18nKey.HOOK$CONTEXT)}:</span>{" "}{event.additional_context}</div>@@ -127,7 +128,7 @@ export function HookExecutionEventMessage({{event.error && (<div className="text-red-400"><span className="text-[var(--oh-text-subtle)]">- {t("HOOK$ERROR")}:+ {t(I18nKey.HOOK$ERROR)}:</span>{" "}{event.error}</div>@@ -136,7 +137,7 @@ export function HookExecutionEventMessage({{event.stdout && (<div><span className="text-[var(--oh-text-subtle)]">- {t("HOOK$OUTPUT")}:+ {t(I18nKey.HOOK$OUTPUT)}:</span><pre className="text-xs bg-[var(--oh-surface)] p-2 rounded mt-1 overflow-x-auto max-h-40 overflow-y-auto">{event.stdout}@@ -147,7 +148,7 @@ export function HookExecutionEventMessage({{event.stderr && (<div><span className="text-[var(--oh-text-subtle)]">- {t("HOOK$STDERR")}:+ {t(I18nKey.HOOK$STDERR)}:</span><pre className="text-xs bg-[var(--oh-surface)] p-2 rounded mt-1 overflow-x-auto max-h-40 overflow-y-auto text-amber-300">{event.stderr}diff --git a/src/i18n/translation.json b/src/i18n/translation.jsonindex ee8510b883..973e6f9a20 100644--- a/src/i18n/translation.json+++ b/src/i18n/translation.json@@ -23001,13 +23001,55 @@"uk": "Пісочницю цієї розмови видалено. Наведена вище історія доступна лише для читання."},"CHAT_INTERFACE$ACP_RESUME_SANDBOX_DESCRIPTION": {- "en": "This conversation's sandbox was recycled. Resume to continue where you left off."+ "en": "This conversation's sandbox was recycled. Resume to continue where you left off.",+ "ja": "This conversation's sandbox was recycled. Resume to continue where you left off.",+ "zh-CN": "This conversation's sandbox was recycled. Resume to continue where you left off.",+ "zh-TW": "This conversation's sandbox was recycled. Resume to continue where you left off.",+ "ko-KR": "This conversation's sandbox was recycled. Resume to continue where you left off.",+ "no": "This conversation's sandbox was recycled. Resume to continue where you left off.",+ "it": "This conversation's sandbox was recycled. Resume to continue where you left off.",+ "pt": "This conversation's sandbox was recycled. Resume to continue where you left off.",+ "es": "This conversation's sandbox was recycled. Resume to continue where you left off.",+ "ar": "This conversation's sandbox was recycled. Resume to continue where you left off.",+ "fr": "This conversation's sandbox was recycled. Resume to continue where you left off.",+ "tr": "This conversation's sandbox was recycled. Resume to continue where you left off.",+ "de": "This conversation's sandbox was recycled. Resume to continue where you left off.",+ "uk": "This conversation's sandbox was recycled. Resume to continue where you left off.",+ "ca": "This conversation's sandbox was recycled. Resume to continue where you left off."},"CHAT_INTERFACE$ACP_RESUME_BUTTON": {- "en": "Resume conversation"+ "en": "Resume conversation",+ "ja": "Resume conversation",+ "zh-CN": "Resume conversation",+ "zh-TW": "Resume conversation",+ "ko-KR": "Resume conversation",+ "no": "Resume conversation",+ "it": "Resume conversation",+ "pt": "Resume conversation",+ "es": "Resume conversation",+ "ar": "Resume conversation",+ "fr": "Resume conversation",+ "tr": "Resume conversation",+ "de": "Resume conversation",+ "uk": "Resume conversation",+ "ca": "Resume conversation"},"CHAT_INTERFACE$ACP_RESUME_STARTING": {- "en": "Resuming…"+ "en": "Resuming…",+ "ja": "Resuming…",+ "zh-CN": "Resuming…",+ "zh-TW": "Resuming…",+ "ko-KR": "Resuming…",+ "no": "Resuming…",+ "it": "Resuming…",+ "pt": "Resuming…",+ "es": "Resuming…",+ "ar": "Resuming…",+ "fr": "Resuming…",+ "tr": "Resuming…",+ "de": "Resuming…",+ "uk": "Resuming…",+ "ca": "Resuming…"},"CHAT_INTERFACE$ERROR_SANDBOX_TITLE": {"en": "Sandbox error",@@ -29758,6 +29800,23 @@"tr": "Kaydedildi, ancak bu arka uç bu kimlik bilgilerini henüz kullanamıyor — ACP dosya kimlik bilgilerini desteklediğinde geçerli olacaklar.","uk": "Збережено, але цей бекенд поки не може використовувати ці облікові дані — вони застосуються, щойно він підтримає файлові облікові дані ACP."},+ "SETTINGS$UPGRADE_BUTTON": {+ "en": "Upgrade",+ "ja": "Upgrade",+ "zh-CN": "Upgrade",+ "zh-TW": "Upgrade",+ "ko-KR": "Upgrade",+ "no": "Upgrade",+ "it": "Upgrade",+ "pt": "Upgrade",+ "es": "Upgrade",+ "ar": "Upgrade",+ "fr": "Upgrade",+ "tr": "Upgrade",+ "de": "Upgrade",+ "uk": "Upgrade",+ "ca": "Upgrade"+ },"SETTINGS$AGENT": {"en": "Agent","ja": "エージェント",diff --git a/src/routes/app-settings.tsx b/src/routes/app-settings.tsxindex 22ad5702fc..8937cbd884 100644--- a/src/routes/app-settings.tsx+++ b/src/routes/app-settings.tsx@@ -200,8 +200,8 @@ export function AppSettingsScreen() {type="submit"isDisabled={isPending || formIsClean}>- {!isPending && t("SETTINGS$SAVE_CHANGES")}- {isPending && t("SETTINGS$SAVING")}+ {!isPending && t(I18nKey.SETTINGS$SAVE_CHANGES)}+ {isPending && t(I18nKey.SETTINGS$SAVING)}</BrandButton></div></div>diff --git a/src/routes/secrets-settings.tsx b/src/routes/secrets-settings.tsxindex 3d6023987b..ae5c287a3f 100644--- a/src/routes/secrets-settings.tsx+++ b/src/routes/secrets-settings.tsx@@ -119,7 +119,7 @@ export function SecretsSettingsScreen() {onClick={() => setView("add-secret-form")}isDisabled={isLoadingSecrets}>- {t("SECRETS$ADD_NEW_SECRET")}+ {t(I18nKey.SECRETS$ADD_NEW_SECRET)}</BrandButton></div>) : null}@@ -209,7 +209,7 @@ export function SecretsSettingsScreen() {{confirmationModalIsVisible && (<ConfirmationModal- text={t("SECRETS$CONFIRM_DELETE_KEY")}+ text={t(I18nKey.SECRETS$CONFIRM_DELETE_KEY)}onConfirm={onConfirmDeleteSecret}onCancel={onCancelDeleteSecret}/>diff --git a/src/routes/vscode-tab.tsx b/src/routes/vscode-tab.tsxindex 4c406a554c..fafc42f7c9 100644--- a/src/routes/vscode-tab.tsx+++ b/src/routes/vscode-tab.tsx@@ -31,7 +31,7 @@ function VSCodeTab() {);} catch (e) {// Silently handle URL parsing errors- setIframeError(t("VSCODE$URL_PARSE_ERROR"));+ setIframeError(t(I18nKey.VSCODE$URL_PARSE_ERROR));}}}, [data?.url]);@@ -77,11 +77,11 @@ function VSCodeTab() {onClick={handleOpenInNewTab}className="min-w-40 justify-center px-6">- {t("VSCODE$OPEN_IN_NEW_TAB")}+ {t(I18nKey.VSCODE$OPEN_IN_NEW_TAB)}</BrandButton>}>- {t("VSCODE$CROSS_ORIGIN_WARNING")}+ {t(I18nKey.VSCODE$CROSS_ORIGIN_WARNING)}</ConversationTabEmptyState>);}diff --git a/src/utils/custom-toast-handlers.tsx b/src/utils/custom-toast-handlers.tsxindex 4f97657d5a..e776b92f77 100644--- a/src/utils/custom-toast-handlers.tsx+++ b/src/utils/custom-toast-handlers.tsx@@ -5,6 +5,7 @@ import { OH_STATUS_ERROR_COLOR } from "#/constants/status-colors";import { calculateToastDuration } from "./toast-duration";import { cn } from "#/utils/utils";import i18n from "#/i18n";+import { I18nKey } from "#/i18n/declaration";// react-hot-toast accepts only CSSProperties via the style option — cannot use classNameconst TOAST_STYLE: CSSProperties = {@@ -89,7 +90,7 @@ export const ERROR_TOAST_OPTIONS: ToastOptions = {};export const displayErrorToast = (error: string | null | undefined) => {- const errorMessage = error || i18n.t("STATUS$ERROR");+ const errorMessage = error || i18n.t(I18nKey.STATUS$ERROR);const duration = calculateToastDuration(errorMessage, 4000);toast(<ErrorToastContent message={errorMessage} />, {...ERROR_TOAST_OPTIONS,diff --git a/src/utils/mutate-with-toast.ts b/src/utils/mutate-with-toast.tsindex 4343903797..2e00f744a0 100644--- a/src/utils/mutate-with-toast.ts+++ b/src/utils/mutate-with-toast.ts@@ -1,6 +1,7 @@import toast from "react-hot-toast";import { UseMutationResult } from "@tanstack/react-query";import i18n from "#/i18n";+import { I18nKey } from "#/i18n/declaration";import {TOAST_OPTIONS,displaySuccessToast,@@ -48,7 +49,7 @@ export async function mutateWithToast<TData, TVariables>(} else if (err instanceof Error) {message = err.message;} else {- message = i18n.t("ERROR$GENERIC");+ message = i18n.t(I18nKey.ERROR$GENERIC);}displayErrorToast(message);}diff --git a/src/utils/send-message-with-attachments.ts b/src/utils/send-message-with-attachments.tsindex b57dd97bf7..83daa5b6b7 100644--- a/src/utils/send-message-with-attachments.ts+++ b/src/utils/send-message-with-attachments.ts@@ -9,6 +9,7 @@ import { convertImageToBase64 } from "#/utils/convert-image-to-base-64";import { displayErrorToast } from "#/utils/custom-toast-handlers";import { partitionImagesForUpload } from "#/components/features/chat/utils/chat-input.utils";import { validateFiles } from "#/utils/file-validation";+import { I18nKey } from "#/i18n/declaration";export interface SendMessageWithAttachmentsResult {text: string;@@ -59,7 +60,7 @@ export async function sendMessageWithAttachments(options: {skippedFiles.forEach((file) => displayErrorToast(file.reason));- const filePrompt = `${t("CHAT_INTERFACE$AUGMENTED_PROMPT_FILES_TITLE")}: ${uploadedFiles.join("\n\n")}`;+ const filePrompt = `${t(I18nKey.CHAT_INTERFACE$AUGMENTED_PROMPT_FILES_TITLE)}: ${uploadedFiles.join("\n\n")}`;const prompt =uploadedFiles.length > 0 ? `${content}\n\n${filePrompt}` : content;