(
msg: {
id?: number
senderName: string
content: string | null
timestamp: number
},
locale?: string
)
| 43 | } |
| 44 | |
| 45 | export function formatMessageCompact( |
| 46 | msg: { |
| 47 | id?: number |
| 48 | senderName: string |
| 49 | content: string | null |
| 50 | timestamp: number |
| 51 | }, |
| 52 | locale?: string |
| 53 | ): string { |
| 54 | const localeStr = isChineseLocale(locale) ? 'zh-CN' : 'en-US' |
| 55 | const time = new Date(msg.timestamp * 1000).toLocaleString(localeStr) |
| 56 | let content = msg.content || t('noContent', locale) |
| 57 | if (content.length > 200) { |
| 58 | content = content.slice(0, 200) + '...' |
| 59 | } |
| 60 | return `${time} ${msg.senderName}: ${content}` |
| 61 | } |
nothing calls this directly
no test coverage detected