https://bugs.kde.org/show_bug.cgi?id=422166

--- Comment #1 from phd <p...@phd.re> ---
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.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to