D14940: kformattest: Use plural suffix (s) consequently

Ralf Habacker noreply at phabricator.kde.org
Thu Aug 23 07:59:42 BST 2018


habacker added a comment.


  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**

REPOSITORY
  R244 KCoreAddons

REVISION DETAIL
  https://phabricator.kde.org/D14940

To: habacker, aacid
Cc: kde-frameworks-devel, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20180823/0de3937a/attachment.html>


More information about the Kde-frameworks-devel mailing list