refactor(i18n): address code review feedback on string legos, hardcoded locales, and fragile checks

This commit is contained in:
yiling
2026-07-06 10:52:55 +08:00
parent 45f3255796
commit 01a9c7cde6
20 changed files with 274 additions and 81 deletions
+1 -2
View File
@@ -10,7 +10,6 @@ import { format, parseISO, isToday, isYesterday } from 'date-fns'
import { Progress } from '@/ui/components/ui/progress'
import { formatTimeAgo } from '@/ui/lib/time'
import { m } from '@/ui/paraglide/messages.js'
import { getLocale } from '@/ui/paraglide/runtime.js'
function formatDayHeader(dateString: string): string {
const date = parseISO(dateString)
@@ -23,7 +22,7 @@ function formatDayHeader(dateString: string): string {
if (isYesterday(date)) {
return m.yesterday()
}
return format(date, getLocale() === 'zh' ? 'yyyy年M月d日' : 'MMMM d, yyyy')
return format(date, m.date_format_long())
}
function formatBytes(bytes: number): string {