D14778: Disable loading of translations when using 'C' locale

Ralf Habacker noreply at phabricator.kde.org
Tue Aug 14 12:11:52 BST 2018


habacker abandoned this revision.
habacker added a comment.


  How to handle single/plural form then ?
  
  QString KFormatPrivate::formatDecimalDuration(quint64 msecs, int decimalPlaces) const
  {
  ...
  
    //: @item:intext %1 is a whole number
    //~ singular %n millisecond
    //~ plural %n milliseconds
    return tr("%n millisecond(s)", nullptr, msecs);
  
  According to http://doc.qt.io/qt-5/i18n-source-translation.html the recent string usage seems to be exactly what is required.
  
  From further inspection the solutions is to use translated reference values
  
  - QCOMPARE(format.formatDecimalDuration(10), QStringLiteral("10 millisecond(s)"));
  - QCOMPARE(format.formatDecimalDuration(10, 3), QStringLiteral("10 millisecond(s)"));
  
  +    QCOMPARE(format.formatDecimalDuration(10), QCoreApplication::translate("KFormat", "%n millisecond(s)", nullptr, 10));
  +    QCOMPARE(format.formatDecimalDuration(10, 3), QCoreApplication::translate("KFormat", "%n millisecond(s)", nullptr, 10));
  
  Thanks for your feedback.

REPOSITORY
  R240 Extra CMake Modules

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

To: habacker, #frameworks, apol
Cc: aacid, kde-frameworks-devel, kde-buildsystem, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-buildsystem/attachments/20180814/7e884bb1/attachment.html>


More information about the Kde-buildsystem mailing list