It works like this:

import QtQuick 2.4
import Ubuntu.Components 1.3

Text {
    text: i18n.tr("singular: %1", "plural: %1", 1).arg("1") + "<br>" +
          i18n.tr("singular: %1", "plural: %1", 2).arg(2)
}


I will update documentation.

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to ubuntu-ui-toolkit in
Ubuntu.
https://bugs.launchpad.net/bugs/1184810

Title:
  [i18n] Confused about using plural forms

Status in ubuntu-ui-toolkit package in Ubuntu:
  Confirmed

Bug description:
  In the i18n component documentation the plural form should be used as:

   * Translate the given input string \a singular or \a plural (depending on 
the number of items \a n)
   * using gettext. Should be called like this:
   *          tr("%n file", "%n files", count)

  But this does not work as expected:

  The result string from this expression is:  ("%n file" or "%n files"
  with the "%n" instead the value)

  checking at the unit2d code I saw that the tr function automatically
  replaces the %n with the count value, but I am not sure if this is the
  correct solution.

  For now I am using  "tr("%1 file", "%1 files", count).arg(count)"

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ubuntu-ui-toolkit/+bug/1184810/+subscriptions

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to