feat: translation (#389)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { useTranslatedEvent } from '@/hooks'
|
||||
import {
|
||||
EmbeddedEmojiParser,
|
||||
EmbeddedEventParser,
|
||||
@@ -24,19 +25,20 @@ export default function ContentPreview({
|
||||
onClick?: React.MouseEventHandler<HTMLDivElement> | undefined
|
||||
}) {
|
||||
const { t } = useTranslation()
|
||||
const translatedEvent = useTranslatedEvent(event?.id)
|
||||
const nodes = useMemo(() => {
|
||||
if (!event) return [{ type: 'text', data: `[${t('Not found the note')}]` }]
|
||||
|
||||
if (event.kind === kinds.Highlights) return []
|
||||
|
||||
return parseContent(event.content, [
|
||||
return parseContent(translatedEvent?.content ?? event.content, [
|
||||
EmbeddedImageParser,
|
||||
EmbeddedVideoParser,
|
||||
EmbeddedEventParser,
|
||||
EmbeddedMentionParser,
|
||||
EmbeddedEmojiParser
|
||||
])
|
||||
}, [event])
|
||||
}, [event, translatedEvent])
|
||||
|
||||
if (event?.kind === kinds.Highlights) {
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user