Skip to content

Commit 02ef9a1

Browse files
Refactor i18n usage in ChatPage for error handling
- Replaced direct i18n import with the t() function for error message translation in ChatPage. - Enhanced code clarity by utilizing the i18n translation function directly within the error handling logic.
1 parent 255b38f commit 02ef9a1

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

frontend/src/pages/Chat/ChatPage.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { chatService } from '../../common/services/ChatService';
88
import { ChatMessageData } from '../../common/components/Chat/ChatMessage';
99
import aiIcon from '../../assets/img/ai-icon.svg';
1010
import { faRobot } from '@fortawesome/free-solid-svg-icons';
11-
import i18n from '../../common/utils/i18n';
1211
import './ChatPage.scss';
1312

1413
/**
@@ -76,7 +75,7 @@ const ChatPage = (): JSX.Element => {
7675
console.error('Error getting AI response:', error);
7776

7877
// Use i18n directly with the full namespace and key
79-
const errorMessage = i18n.t('chat.general', { ns: 'errors' });
78+
const errorMessage = t('chat.general', { ns: 'errors' });
8079

8180
const assistantErrorMessage = chatService.createAssistantMessage(errorMessage);
8281
setMessages(prevMessages => [...prevMessages, assistantErrorMessage]);

0 commit comments

Comments
 (0)