Summary: | Large number of files can be displayed in scientific notation in copying notification | ||
---|---|---|---|
Product: | [Plasma] plasmashell | Reporter: | phd <phd> |
Component: | Notifications | Assignee: | Kai Uwe Broulik <kde> |
Status: | CONFIRMED --- | ||
Severity: | minor | CC: | Avamander, gabrielhuwe, nate, phd, plasma-bugs |
Priority: | NOR | ||
Version: | 5.18.5 | ||
Target Milestone: | 1.0 | ||
Platform: | Ubuntu | ||
OS: | Linux | ||
See Also: | https://bugs.kde.org/show_bug.cgi?id=429284 | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: | plasma-copying-large-number-of-files-scientific-notation-bug.png |
I have investigated this issue a bit. This label is displayed by /usr/share/plasma/plasmoids/org.kde.plasma.notifications/contents/ui/JobDetails.qml from plasma-workspace: > text: { > var processed = jobDetails["processed" + modelData]; > var total = jobDetails["total" + modelData]; > > if (processed > 0 || total > 1) { > if (processed > 0 && total > 0 && processed <= total) { > switch(modelData) { > case "Bytes": > return i18ndc("plasma_applet_org.kde.plasma.notifications", "How many bytes have been copied", "%2 of %1", > KCoreAddons.Format.formatByteSize(total), > KCoreAddons.Format.formatByteSize(processed)) > case "Files": > return i18ndcp("plasma_applet_org.kde.plasma.notifications", "How many files have been copied", "%2 of %1 file", "%2 of %1 files", > total, processed); > case "Directories": > return i18ndcp("plasma_applet_org.kde.plasma.notifications", "How many dirs have been copied", "%2 of %1 folder", "%2 of %1 folders", > total, processed); > } > } else { > switch(modelData) { > case "Bytes": > return KCoreAddons.Format.formatByteSize(processed || total) > case "Files": > return i18ndp("plasma_applet_org.kde.plasma.notifications", "%1 file", "%1 files", (processed || total)); > case "Directories": > return i18ndp("plasma_applet_org.kde.plasma.notifications", "%1 folder", "%1 folders", (processed || total)); > } > } > } > > return ""; > } If you want to reproduce this issue easily, just do this and start any copying job lasting long enough: > var processed = jobDetails["processed" + modelData] + 10000000; > var total = jobDetails["total" + modelData] + 10000000; And now comes the fun part. This seems to a very strange problem with i18ndcp() formatting. "%2 of %1 files" always fails for the first placeholder (%2), but never for the second one. You can even reorder the arguments you supply to that function!: > return i18ndcp("plasma_applet_org.kde.plasma.notifications", "How many files have been copied", "%2 of %1 file", "%2 of %1 files", > /* total , processed */ processed, total); and still it will fail only for the first placeholder (%2), despite the fact it now displays a number which was previously formatted fine as the second placeholder (%1). So it is not a problem with the number supplied, but somewhere deeper in i18ndcp() formatting logic. i18n (KLocalizedString) does format numbers since recently, maybe it should be changed to never use scientific notation? *** Bug 424289 has been marked as a duplicate of this bug. *** *** Bug 429284 has been marked as a duplicate of this bug. *** |
Created attachment 128854 [details] plasma-copying-large-number-of-files-scientific-notation-bug.png SUMMARY Number of files is sometimes displayed in scientific notation in copying notification: en-US: "1.75219e+06 of 1,777,348 files" pl-PL: "1,75219e+06 z 1'777'348 plików" This happens when copying large number (1 to 2 million or more) of files. Screenshot attached (Polish localization). STEPS TO REPRODUCE 1. start copying large number (1 to 2 million) of files 2. show the details of the copying notification in Plasma OBSERVED RESULT Number of files is sometimes displayed in scientific notation in copying notification. EXPECTED RESULT Number of files should always be displayed as an integer number. SOFTWARE/OS VERSIONS Linux: Ubuntu 20.04 KDE Plasma Version: 5.18.5 KDE Frameworks Version: 5.68.0 Qt Version: 5.12.8