@@ -10,6 +10,7 @@ import * as React from 'react';
1010import { cn , Button , Card , CardHeader , CardTitle , CardContent } from '@object-ui/components' ;
1111import { MessageSquare , Send , Pin , Search , X } from 'lucide-react' ;
1212import type { CommentEntry } from '@object-ui/types' ;
13+ import { useDetailTranslation } from './useDetailTranslation' ;
1314
1415export interface RecordCommentsProps {
1516 comments : CommentEntry [ ] ;
@@ -50,6 +51,7 @@ export const RecordComments: React.FC<RecordCommentsProps> = ({
5051 searchable = false ,
5152 className,
5253} ) => {
54+ const { t } = useDetailTranslation ( ) ;
5355 const [ newComment , setNewComment ] = React . useState ( '' ) ;
5456 const [ isSubmitting , setIsSubmitting ] = React . useState ( false ) ;
5557 const [ searchQuery , setSearchQuery ] = React . useState ( '' ) ;
@@ -98,7 +100,7 @@ export const RecordComments: React.FC<RecordCommentsProps> = ({
98100 < CardHeader >
99101 < CardTitle className = "flex items-center gap-2 text-base" >
100102 < MessageSquare className = "h-4 w-4" />
101- Comments
103+ { t ( 'detail.comments' ) }
102104 < span className = "text-sm font-normal text-muted-foreground" >
103105 ({ comments . length } )
104106 </ span >
@@ -112,7 +114,7 @@ export const RecordComments: React.FC<RecordCommentsProps> = ({
112114 < Search className = "absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground" />
113115 < input
114116 className = "w-full rounded-md border border-input bg-background pl-8 pr-8 py-1.5 text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
115- placeholder = "Search comments…"
117+ placeholder = { t ( 'detail.searchComments' ) }
116118 value = { searchQuery }
117119 onChange = { ( e ) => setSearchQuery ( e . target . value ) }
118120 aria-label = "Search comments"
@@ -136,7 +138,7 @@ export const RecordComments: React.FC<RecordCommentsProps> = ({
136138 < div className = "flex gap-2" >
137139 < textarea
138140 className = "flex-1 min-h-[60px] rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring resize-none"
139- placeholder = "Add a comment… (Ctrl+Enter to submit)"
141+ placeholder = { t ( 'detail.addCommentPlaceholder' ) }
140142 value = { newComment }
141143 onChange = { ( e ) => setNewComment ( e . target . value ) }
142144 onKeyDown = { handleKeyDown }
@@ -157,7 +159,7 @@ export const RecordComments: React.FC<RecordCommentsProps> = ({
157159 { /* Comment List */ }
158160 { sortedComments . length === 0 ? (
159161 < p className = "text-sm text-muted-foreground text-center py-4" >
160- { searchQuery . trim ( ) ? 'No matching comments' : 'No comments yet' }
162+ { searchQuery . trim ( ) ? t ( 'detail.noMatchingComments' ) : t ( 'detail.noCommentsYet' ) }
161163 </ p >
162164 ) : (
163165 < div className = "space-y-3" >
@@ -187,7 +189,7 @@ export const RecordComments: React.FC<RecordCommentsProps> = ({
187189 { comment . pinned && (
188190 < span className = "text-xs text-amber-600 flex items-center gap-0.5" >
189191 < Pin className = "h-3 w-3" />
190- Pinned
192+ { t ( 'detail.pinned' ) }
191193 </ span >
192194 ) }
193195 </ div >
@@ -201,7 +203,7 @@ export const RecordComments: React.FC<RecordCommentsProps> = ({
201203 aria-label = { comment . pinned ? 'Unpin comment' : 'Pin comment' }
202204 >
203205 < Pin className = "h-3 w-3" />
204- { comment . pinned ? 'Unpin' : 'Pin' }
206+ { comment . pinned ? t ( 'detail.unpin' ) : t ( 'detail.pin' ) }
205207 </ button >
206208 ) }
207209 </ div >
0 commit comments