fix(web): localize duplicates counter and hoist processed math

duplicateCount existed only in en.json, so 17 locales fell back to
English inside an otherwise localized panel. The processed count,
percentage and progress bar computed success+failed+duplicates
inline three times; hoist it once so the three can never disagree.
This commit is contained in:
sripwoud
2026-08-18 21:59:34 +02:00
parent fa98f161c6
commit 46eeab8100
18 changed files with 23 additions and 10 deletions

View File

@@ -119,6 +119,9 @@ export default function ImportPage() {
const abortRef = useRef<AbortController | null>(null); const abortRef = useRef<AbortController | null>(null);
const processedCount = progress ? progress.success + progress.failed + progress.duplicates : 0;
const processedPct = progress && progress.total > 0 ? (processedCount / progress.total) * 100 : 0;
useEffect(() => { useEffect(() => {
return () => { abortRef.current?.abort(); }; return () => { abortRef.current?.abort(); };
}, []); }, []);
@@ -659,18 +662,11 @@ export default function ImportPage() {
<div className="space-y-1.5"> <div className="space-y-1.5">
<div className="flex justify-between text-xs text-muted-foreground"> <div className="flex justify-between text-xs text-muted-foreground">
<span> <span>
{t('import.processed', { current: progress.success + progress.failed + progress.duplicates, total: progress.total })} {t('import.processed', { current: processedCount, total: progress.total })}
</span>
<span>
{progress.total > 0
? Math.round(((progress.success + progress.failed + progress.duplicates) / progress.total) * 100)
: 0}%
</span> </span>
<span>{Math.round(processedPct)}%</span>
</div> </div>
<Progress <Progress value={processedPct} className="h-2" />
value={progress.total > 0 ? ((progress.success + progress.failed + progress.duplicates) / progress.total) * 100 : 0}
className="h-2"
/>
</div> </div>
)} )}

View File

@@ -727,6 +727,7 @@
"detectedFolder": "مكتشف", "detectedFolder": "مكتشف",
"detectedFrom": "مكتشف من", "detectedFrom": "مكتشف من",
"dropHere": "أفلت ملفات .eml / .mbox / .pst هنا", "dropHere": "أفلت ملفات .eml / .mbox / .pst هنا",
"duplicateCount": "تم تخطي {{count}} من التكرارات",
"failed": "فشل الاستيراد", "failed": "فشل الاستيراد",
"failedCount": "{{count}} فشل", "failedCount": "{{count}} فشل",
"failedDetails": "العناصر الفاشلة", "failedDetails": "العناصر الفاشلة",

View File

@@ -727,6 +727,7 @@
"detectedFolder": "Registreret", "detectedFolder": "Registreret",
"detectedFrom": "Registreret fra", "detectedFrom": "Registreret fra",
"dropHere": "Slip .eml / .mbox / .pst-filer her", "dropHere": "Slip .eml / .mbox / .pst-filer her",
"duplicateCount": "{{count}} dubletter sprunget over",
"failed": "Import mislykkedes", "failed": "Import mislykkedes",
"failedCount": "{{count}} fejlet", "failedCount": "{{count}} fejlet",
"failedDetails": "Fejlede elementer", "failedDetails": "Fejlede elementer",

View File

@@ -727,6 +727,7 @@
"detectedFolder": "Erkannt", "detectedFolder": "Erkannt",
"detectedFrom": "Erkannt aus", "detectedFrom": "Erkannt aus",
"dropHere": ".eml / .mbox / .pst-Dateien hierher ziehen", "dropHere": ".eml / .mbox / .pst-Dateien hierher ziehen",
"duplicateCount": "{{count}} Duplikate übersprungen",
"failed": "Import fehlgeschlagen", "failed": "Import fehlgeschlagen",
"failedCount": "{{count}} fehlgeschlagen", "failedCount": "{{count}} fehlgeschlagen",
"failedDetails": "Fehlgeschlagene Elemente", "failedDetails": "Fehlgeschlagene Elemente",

View File

@@ -727,6 +727,7 @@
"detectedFolder": "Detectado", "detectedFolder": "Detectado",
"detectedFrom": "Detectado de", "detectedFrom": "Detectado de",
"dropHere": "Arrastre archivos .eml / .mbox / .pst aquí", "dropHere": "Arrastre archivos .eml / .mbox / .pst aquí",
"duplicateCount": "{{count}} duplicados omitidos",
"failed": "Error al importar", "failed": "Error al importar",
"failedCount": "{{count}} fallidos", "failedCount": "{{count}} fallidos",
"failedDetails": "Elementos fallidos", "failedDetails": "Elementos fallidos",

View File

@@ -727,6 +727,7 @@
"detectedFolder": "Tunnistettu", "detectedFolder": "Tunnistettu",
"detectedFrom": "Tunnistettu lähteestä", "detectedFrom": "Tunnistettu lähteestä",
"dropHere": "Pudota .eml / .mbox / .pst -tiedostot tähän", "dropHere": "Pudota .eml / .mbox / .pst -tiedostot tähän",
"duplicateCount": "{{count}} kaksoiskappaletta ohitettu",
"failed": "Tuonti epäonnistui", "failed": "Tuonti epäonnistui",
"failedCount": "{{count}} epäonnistui", "failedCount": "{{count}} epäonnistui",
"failedDetails": "Epäonnistuneet kohteet", "failedDetails": "Epäonnistuneet kohteet",

View File

@@ -727,6 +727,7 @@
"detectedFolder": "Détecté", "detectedFolder": "Détecté",
"detectedFrom": "Détecté depuis", "detectedFrom": "Détecté depuis",
"dropHere": "Déposez les fichiers .eml / .mbox / .pst ici", "dropHere": "Déposez les fichiers .eml / .mbox / .pst ici",
"duplicateCount": "{{count}} doublon(s) ignoré(s)",
"failed": "Échec de l'importation", "failed": "Échec de l'importation",
"failedCount": "{{count}} échoué(s)", "failedCount": "{{count}} échoué(s)",
"failedDetails": "Éléments en échec", "failedDetails": "Éléments en échec",

View File

@@ -727,6 +727,7 @@
"detectedFolder": "Rilevato", "detectedFolder": "Rilevato",
"detectedFrom": "Rilevato da", "detectedFrom": "Rilevato da",
"dropHere": "Trascina i file .eml / .mbox / .pst qui", "dropHere": "Trascina i file .eml / .mbox / .pst qui",
"duplicateCount": "{{count}} duplicati saltati",
"failed": "Importazione fallita", "failed": "Importazione fallita",
"failedCount": "{{count}} falliti", "failedCount": "{{count}} falliti",
"failedDetails": "Elementi falliti", "failedDetails": "Elementi falliti",

View File

@@ -727,6 +727,7 @@
"detectedFolder": "放出演出", "detectedFolder": "放出演出",
"detectedFrom": "検出元:", "detectedFrom": "検出元:",
"dropHere": "ここに .eml / .mbox / .pst 文件をドロップ", "dropHere": "ここに .eml / .mbox / .pst 文件をドロップ",
"duplicateCount": "{{count}} 件の重複をスキップ",
"failed": "インポート失敗", "failed": "インポート失敗",
"failedCount": "{{count}} 件の失敗", "failedCount": "{{count}} 件の失敗",
"failedDetails": "失敗したアイテム", "failedDetails": "失敗したアイテム",

View File

@@ -727,6 +727,7 @@
"detectedFolder": "감지됨", "detectedFolder": "감지됨",
"detectedFrom": "감지 대상:", "detectedFrom": "감지 대상:",
"dropHere": "여기에 .eml / .mbox / .pst 파일 끌어놓기", "dropHere": "여기에 .eml / .mbox / .pst 파일 끌어놓기",
"duplicateCount": "{{count}}개 중복 건너뜀",
"failed": "가져오기 실패", "failed": "가져오기 실패",
"failedCount": "{{count}}개 실패", "failedCount": "{{count}}개 실패",
"failedDetails": "실패한 항목", "failedDetails": "실패한 항목",

View File

@@ -727,6 +727,7 @@
"detectedFolder": "Gedetecteerd", "detectedFolder": "Gedetecteerd",
"detectedFrom": "Gedetecteerd uit", "detectedFrom": "Gedetecteerd uit",
"dropHere": "Sleep .eml / .mbox / .pst bestanden hierheen", "dropHere": "Sleep .eml / .mbox / .pst bestanden hierheen",
"duplicateCount": "{{count}} duplicaten overgeslagen",
"failed": "Import mislukt", "failed": "Import mislukt",
"failedCount": "{{count}} mislukt", "failedCount": "{{count}} mislukt",
"failedDetails": "Mislukte items", "failedDetails": "Mislukte items",

View File

@@ -727,6 +727,7 @@
"detectedFolder": "Registrert", "detectedFolder": "Registrert",
"detectedFrom": "Registrert fra", "detectedFrom": "Registrert fra",
"dropHere": "Slipp .eml / .mbox / .pst-filer her", "dropHere": "Slipp .eml / .mbox / .pst-filer her",
"duplicateCount": "{{count}} duplikater hoppet over",
"failed": "Import mislyktes", "failed": "Import mislyktes",
"failedCount": "{{count}} feilet", "failedCount": "{{count}} feilet",
"failedDetails": "Feilede elementer", "failedDetails": "Feilede elementer",

View File

@@ -727,6 +727,7 @@
"detectedFolder": "Wykryto", "detectedFolder": "Wykryto",
"detectedFrom": "Wykryto z", "detectedFrom": "Wykryto z",
"dropHere": "Upuść pliki .eml / .mbox / .pst tutaj", "dropHere": "Upuść pliki .eml / .mbox / .pst tutaj",
"duplicateCount": "Pominięto duplikatów: {{count}}",
"failed": "Import nie powiódł się", "failed": "Import nie powiódł się",
"failedCount": "Niepowodzenie: {{count}}", "failedCount": "Niepowodzenie: {{count}}",
"failedDetails": "Nieudane elementy", "failedDetails": "Nieudane elementy",

View File

@@ -727,6 +727,7 @@
"detectedFolder": "Detectado", "detectedFolder": "Detectado",
"detectedFrom": "Detectado de", "detectedFrom": "Detectado de",
"dropHere": "Solte arquivos .eml / .mbox / .pst aqui", "dropHere": "Solte arquivos .eml / .mbox / .pst aqui",
"duplicateCount": "{{count}} duplicados ignorados",
"failed": "Falha na importação", "failed": "Falha na importação",
"failedCount": "{{count}} falharam", "failedCount": "{{count}} falharam",
"failedDetails": "Itens com falha", "failedDetails": "Itens com falha",

View File

@@ -727,6 +727,7 @@
"detectedFolder": "Обнаружено", "detectedFolder": "Обнаружено",
"detectedFrom": "Обнаружено из", "detectedFrom": "Обнаружено из",
"dropHere": "Перетащите файлы .eml / .mbox / .pst сюда", "dropHere": "Перетащите файлы .eml / .mbox / .pst сюда",
"duplicateCount": "Пропущено дубликатов: {{count}}",
"failed": "Ошибка импорта", "failed": "Ошибка импорта",
"failedCount": "Ошибок: {{count}}", "failedCount": "Ошибок: {{count}}",
"failedDetails": "Неудачные элементы", "failedDetails": "Неудачные элементы",

View File

@@ -727,6 +727,7 @@
"detectedFolder": "Identifierad", "detectedFolder": "Identifierad",
"detectedFrom": "Identifierad från", "detectedFrom": "Identifierad från",
"dropHere": "Släpp .eml / .mbox / .pst-filer här", "dropHere": "Släpp .eml / .mbox / .pst-filer här",
"duplicateCount": "{{count}} dubbletter hoppades över",
"failed": "Import misslyckades", "failed": "Import misslyckades",
"failedCount": "{{count}} misslyckades", "failedCount": "{{count}} misslyckades",
"failedDetails": "Misslyckade objekt", "failedDetails": "Misslyckade objekt",

View File

@@ -727,6 +727,7 @@
"detectedFolder": "已識別", "detectedFolder": "已識別",
"detectedFrom": "識別自", "detectedFrom": "識別自",
"dropHere": "將 .eml / .mbox / .pst 檔案拖曳到此處", "dropHere": "將 .eml / .mbox / .pst 檔案拖曳到此處",
"duplicateCount": "已略過 {{count}} 個重複項",
"failed": "匯入失敗", "failed": "匯入失敗",
"failedCount": "{{count}} 個失敗", "failedCount": "{{count}} 個失敗",
"failedDetails": "失敗詳情", "failedDetails": "失敗詳情",

View File

@@ -737,6 +737,7 @@
"detectedFolder": "已识别", "detectedFolder": "已识别",
"detectedFrom": "识别自", "detectedFrom": "识别自",
"dropHere": "将 .eml / .mbox / .pst 文件拖拽到此处", "dropHere": "将 .eml / .mbox / .pst 文件拖拽到此处",
"duplicateCount": "已跳过 {{count}} 个重复项",
"failed": "导入失败", "failed": "导入失败",
"failedCount": "{{count}} 个失败", "failedCount": "{{count}} 个失败",
"failedDetails": "失败详情", "failedDetails": "失败详情",