Mixing plural '(s)' and translated 's' suffix could not be correct.
Details
Diff Detail
- Repository
- R244 KCoreAddons
- Branch
- master
- Lint
No Linters Available - Unit
No Unit Test Coverage - Build Status
Buildable 2016 Build 2034: arc lint + arc unit
- type fix in KFormatTest::formatDecimalDuration
- missing plural fix in KFormatPrivate::formatDecimalDuration
According to the section'Handling of plurals' on http://doc.qt.io/qt-5/i18n-source-translation.html, for plurals an '(s)' is used instead of the 's' as suffx. You are refering to a different spec ?
Yes, that is for plurals, not for decimals.
1.3 days is not a plural in the sense described there[1], it's a decimal number and it follows different rules.
[1] see how n is an integer not a float
I see - Qt lacks support for choosing the correct translation string for floating point values like this:
qreal value = 1.0; tr("%n second(s)", nullptr, value).
which should return 1.0 second
qreal value = 1.34; tr("%n second(s)", nullptr, value).
which should return 1.34 seconds
qreal value = 0.0; tr("%n second(s)", nullptr, value).
which should return 0.0 seconds
and for strings:
int decimalPlaces = 2; qreal MSecsInSecond = 1000; qreal msecs = 1000.0 return tr("%n second(s)").arg(m_locale.toString(msecs / (MSecsInSecond * 1.0), 'f', decimalPlaces));
which should return 1.00 second
int decimalPlaces = 2; qreal MSecsInSecond = 1000; qreal msecs = 1100.0 return tr("%n second(s)").arg(m_locale.toString(msecs / (MSecsInSecond * 1.0), 'f', decimalPlaces));
which should return 1.10 seconds
Are you sure about that? Most answer i find online say 1.0 seconds is the right way to write it, basically, because if you write 1.0 seconds is because you know it's not 1 second, but something that rounds to 1.0 seconds, i.e in the 0.96 to 1.04 range with a precision of one digit.
https://forum.wordreference.com/threads/decimals-plural-singular.2054431/#post-10279600 listed many public organisations that are using signular for values between 1 and -1.
At this point, does it really matter though? Qt doesn't support what you want to do, so you need to convince them not us.