feat(SPA): i18n internationzalization, english and french

This commit is contained in:
fsylvain committed 2026-10-03 01:53:49 +02:00
1 parent 7f1e8e572d
commit 721311a643
88 files changed
+4438 -1148

No files matched your search

+14 -2
View File
@@ -1,3 +1,4 @@
import { t } from '@/i18n'
import type { MediaItem } from '@/composables/useMedia'
import { formatDimensions, formatSize } from '@/lib/mediaFormat'
@@ -18,7 +19,11 @@ function byPreference(first: MediaItem, second: MediaItem) {
export function groupHeader(copies: MediaItem[]) {
const [first] = copies
return `${copies.length} identical images · ${formatSize(first!.size)} each · ${formatDimensions(first!.width, first!.height)}`
return t('{0} identical images · {1} each · {2}', [
copies.length,
formatSize(first!.size),
formatDimensions(first!.width, first!.height),
])
}
export function groupDuplicates(items: MediaItem[]): DuplicateGroup[] {
@@ -30,7 +35,14 @@ export function groupDuplicates(items: MediaItem[]): DuplicateGroup[] {
.filter(([, copies]) => copies.length > 1)
.map(([hash, copies]) => {
const sorted = [...copies].sort(byPreference)
return { hash, copies: sorted, suggested: sorted[0]!, header: groupHeader(sorted) }
return {
hash,
copies: sorted,
suggested: sorted[0]!,
get header() {
return groupHeader(sorted)
},
}
})
.sort((first, second) => byAge(first.suggested, second.suggested))
}