feat(desktop): add i18n infrastructure with react-intl (#8105)

This commit is contained in:
jh-block
2026-03-27 19:39:50 +01:00
committed by GitHub
parent d596113e72
commit a6765fbcd9
172 changed files with 13793 additions and 2054 deletions
@@ -1,6 +1,18 @@
import { ActionRequired } from '../api';
import { defineMessages, useIntl } from '../i18n';
import ToolApprovalButtons from './ToolApprovalButtons';
const i18n = defineMessages({
allowToolCall: {
id: 'toolConfirmation.allowToolCall',
defaultMessage: 'Do you allow this tool call?',
},
gooseWouldLikeToCall: {
id: 'toolConfirmation.gooseWouldLikeToCall',
defaultMessage: 'Goose would like to call the above tool. Allow?',
},
});
type ToolConfirmationData = Extract<ActionRequired['data'], { actionType: 'toolConfirmation' }>;
interface ToolConfirmationProps {
@@ -14,6 +26,7 @@ export default function ToolConfirmation({
isClicked,
actionRequiredContent,
}: ToolConfirmationProps) {
const intl = useIntl();
const data = actionRequiredContent.data as ToolConfirmationData;
const { id, toolName, prompt } = data;
@@ -21,8 +34,8 @@ export default function ToolConfirmation({
<div className="goose-message-content bg-background-primary border border-border-primary rounded-2xl overflow-hidden">
<div className="bg-background-secondary px-4 py-2 text-text-primary">
{prompt
? 'Do you allow this tool call?'
: 'Goose would like to call the above tool. Allow?'}
? intl.formatMessage(i18n.allowToolCall)
: intl.formatMessage(i18n.gooseWouldLikeToCall)}
</div>
<ToolApprovalButtons
data={{ id, toolName, prompt: prompt ?? undefined, sessionId, isClicked }}