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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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