SUMMARY *** NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols. See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports *** In https://lxr.kde.org/source/frameworks/kcoreaddons/src/lib/util/kformatprivate.cpp at 512nd line there is a line "return tr("%1 minutes ago").arg(minutesToNow);" It's unfriendly for languages where e.g. "2 minutes ago" is translated differently than "30 minutes ago". Please fix this. Thank you in advance. STEPS TO REPRODUCE 1. 2. 3. OBSERVED RESULT EXPECTED RESULT SOFTWARE/OS VERSIONS Windows: macOS: Linux/KDE Plasma: (available in About System) KDE Plasma Version: KDE Frameworks Version: Qt Version: ADDITIONAL INFORMATION
Maybe we can use i18np() here?
kcoreaddons is tier1, sadly, so Qt only
We can perhaps mitigate this with `if (minutesToNow == 30) {` and as many branches as necessary to better accommodate different languages. @NSLW can you make recommendation where does your language needs different translation based on the number of minutes. @NSLW What is the your language btw ?
(In reply to Méven from comment #3) > We can perhaps mitigate this with > `if (minutesToNow == 30) {` and as many branches as necessary to better > accommodate different languages. Wouldn't that be like rewriting the logic of plural forms which is already in gettext? Anyway, Qt, should be able to handle this: https://doc.qt.io/qt-5/i18n-source-translation.html#handling-plurals https://doc.qt.io/archives/qt-5.12/i18n-plural-rules.html
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kcoreaddons/-/merge_requests/271
Git commit f284392d30ded03c8142f6baad0335e67fd53c8a by Méven Car. Committed on 01/12/2022 at 10:55. Pushed by meven into branch 'bug-462261'. Better Pluralize 'n minutes ago' M +1 -1 autotests/kformattest.cpp M +1 -1 src/lib/util/kformatprivate.cpp https://invent.kde.org/frameworks/kcoreaddons/commit/f284392d30ded03c8142f6baad0335e67fd53c8a
(In reply to Méven from comment #3) > We can perhaps mitigate this with > `if (minutesToNow == 30) {` and as many branches as necessary to better > accommodate different languages. > > @NSLW can you make recommendation where does your language needs different > translation based on the number of minutes. > > @NSLW What is the your language btw ? It's Polish and it goes like this: 1 minuta 2-4 minuty 5-21 minut 22-24 minuty 25-31 minut (In reply to Méven from comment #3) > We can perhaps mitigate this with > `if (minutesToNow == 30) {` and as many branches as necessary to better > accommodate different languages. > > @NSLW can you make recommendation where does your language needs different > translation based on the number of minutes. > > @NSLW What is the your language btw ? (In reply to Méven from comment #3) > We can perhaps mitigate this with > `if (minutesToNow == 30) {` and as many branches as necessary to better > accommodate different languages. > > @NSLW can you make recommendation where does your language needs different > translation based on the number of minutes. > > @NSLW What is the your language btw ? It's Polish and it goes like this: 1 minuta 2-4 minuty 5-21 minut 22-24 minuty 25-31 minut ... I think that your idea is good. There are only three cases in this case for Polish. "%n minute(s)" is in general not a good solution because in Polish you make plural forms not by appending a single letter like in English but by replacing letters. Thank you all for interest in fixing this bug.
Git commit 752ad70df69fc98ae35ba59313e5633b200150b8 by Méven Car, on behalf of Méven Car. Committed on 17/12/2022 at 10:41. Pushed by meven into branch 'master'. Better Pluralize 'n minutes ago' FIXED-IN: 5.102 M +1 -1 autotests/kformattest.cpp M +4 -1 src/lib/util/kformatprivate.cpp https://invent.kde.org/frameworks/kcoreaddons/commit/752ad70df69fc98ae35ba59313e5633b200150b8
It's still not fixed. See comment #7.
(In reply to NSLW from comment #9) > It's still not fixed. See comment #7. Why? It is now handled by the translation system, which should provide multiple forms for Polish. Of course this will be visible in the next release of Frameworks (5.102).
(In reply to Luigi Toscano from comment #10) > (In reply to NSLW from comment #9) > > It's still not fixed. See comment #7. > > Why? It is now handled by the translation system, which should provide > multiple forms for Polish. Of course this will be visible in the next > release of Frameworks (5.102). He changed "minutes" to "minute(s)", and it will appear as a single translation unit in the translation system. It would need to have three translation units for it to be fixed.
(In reply to NSLW from comment #11) > (In reply to Luigi Toscano from comment #10) > > (In reply to NSLW from comment #9) > > > It's still not fixed. See comment #7. > > > > Why? It is now handled by the translation system, which should provide > > multiple forms for Polish. Of course this will be visible in the next > > release of Frameworks (5.102). > > He changed "minutes" to "minute(s)", and it will appear as a single > translation unit in the translation system. It would need to have three > translation units for it to be fixed. Again, that's the English string, which has only two forms. The translation system takes care of the plural forms, just like it happens with all the other strings. If it didn't work, you wouldn't have any properly translated string. Please check the original English strings when multiple cases are involved and the translation work, and you will see that it is exactly like this. After the change, the translation in the pl file is: #. @item:intext %1 is a whole number #: lib/util/kformatprivate.cpp:515 #, fuzzy, qt-format #| msgctxt "KFormat|" #| msgid "%1 minutes ago" msgctxt "KFormat|" msgid "%n minute(s) ago" msgid_plural "%n minute(s) ago" msgstr[0] "%1 minuty temu" msgstr[1] "%1 minuty temu" msgstr[2] "%1 minuty temu" which needs to be fixed by the Polish translators of course. It will be fixed in the next release.
(In reply to Luigi Toscano from comment #12) > (In reply to NSLW from comment #11) > > (In reply to Luigi Toscano from comment #10) > > > (In reply to NSLW from comment #9) > > > > It's still not fixed. See comment #7. > > > > > > Why? It is now handled by the translation system, which should provide > > > multiple forms for Polish. Of course this will be visible in the next > > > release of Frameworks (5.102). > > > > He changed "minutes" to "minute(s)", and it will appear as a single > > translation unit in the translation system. It would need to have three > > translation units for it to be fixed. > > Again, that's the English string, which has only two forms. The translation > system takes care of the plural forms, just like it happens with all the > other strings. If it didn't work, you wouldn't have any properly translated > string. Please check the original English strings when multiple cases are > involved and the translation work, and you will see that it is exactly like > this. > > After the change, the translation in the pl file is: > > #. @item:intext %1 is a whole number > #: lib/util/kformatprivate.cpp:515 > #, fuzzy, qt-format > #| msgctxt "KFormat|" > #| msgid "%1 minutes ago" > msgctxt "KFormat|" > msgid "%n minute(s) ago" > msgid_plural "%n minute(s) ago" > msgstr[0] "%1 minuty temu" > msgstr[1] "%1 minuty temu" > msgstr[2] "%1 minuty temu" > > which needs to be fixed by the Polish translators of course. It will be > fixed in the next release. Ok, thanks for the explanation. It seems that I did not understand the patch. BTW. Thanks for the fix.