feat(desktop): add i18n infrastructure with react-intl (#8105)
This commit is contained in:
@@ -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 }}
|
||||
|
||||
Reference in New Issue
Block a user