Skip to content

Commit b7582b3

Browse files
Set details to translated message in ExpandableMessage component
This commit further improves the error message display by: 1. Setting the details to the translated message instead of an empty string 2. Ensuring that both headline and details show the properly translated text 3. Maintaining the behavior of hiding the expand/collapse button for translation keys These changes ensure that error messages are properly displayed with their translated content.
1 parent 028bce2 commit b7582b3

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Diff for: frontend/src/components/features/chat/expandable-message.tsx

+6-3
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,10 @@ export function ExpandableMessage({
4545

4646
// If the message is the same as the ID or is itself a translation key
4747
if (message === id || isMessageTranslationKey) {
48-
// Don't show any details, just the translated headline
49-
setDetails("");
48+
// Set details to the translated message instead of empty string
49+
// This ensures we show the proper translated text
50+
setDetails(t(id));
51+
// Don't show the expand/collapse button since it's redundant
5052
setShowDetails(false);
5153
} else {
5254
// Show the message as details
@@ -57,7 +59,8 @@ export function ExpandableMessage({
5759
} else if (isMessageTranslationKey && i18n.exists(message)) {
5860
// If the message itself is a translation key but wasn't passed as id
5961
setHeadline(t(message));
60-
setDetails("");
62+
// Set details to the translated message
63+
setDetails(t(message));
6164
setShowDetails(false);
6265
}
6366
}, [id, message, i18n.language, t]);

0 commit comments

Comments
 (0)