Merge lp:~tpeeters/ubuntu-ui-toolkit/fixI18nDocs into lp:ubuntu-ui-toolkit/staging

Proposed by Tim Peeters on 2016-06-20
Status: Merged
Approved by: Tim Peeters on 2016-06-22
Approved revision: 2016
Merged at revision: 2017
Proposed branch: lp:~tpeeters/ubuntu-ui-toolkit/fixI18nDocs
Merge into: lp:ubuntu-ui-toolkit/staging
Diff against target: 25 lines (+5/-3)
1 file modified
src/Ubuntu/Components/plugin/i18n.cpp (+5/-3)
To merge this branch: bzr merge lp:~tpeeters/ubuntu-ui-toolkit/fixI18nDocs
Reviewer Review Type Date Requested Status
ubuntu-sdk-build-bot continuous-integration Approve on 2016-06-22
Christian Dywan 2016-06-20 Approve on 2016-06-20
Review via email: mp+297916@code.launchpad.net

Commit Message

Improve the i18n documentation for plurals.

To post a comment you must log in.
Christian Dywan (kalikiana) wrote :

Lovely doc fixes!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Ubuntu/Components/plugin/i18n.cpp'
2--- src/Ubuntu/Components/plugin/i18n.cpp 2016-05-25 12:48:10 +0000
3+++ src/Ubuntu/Components/plugin/i18n.cpp 2016-06-20 14:33:19 +0000
4@@ -167,8 +167,10 @@
5 /*!
6 * \qmlmethod string i18n::tr(string singular, string plural, int n)
7 * Translate the given input string \a singular or \a plural (depending on the number of items \a n)
8- * using gettext. Should be called like this:
9- * tr("%n file", "%n files", count)
10+ * using gettext.
11+ * Note that tr() does not automatically insert the values in the QString,
12+ * so it should be called like this:
13+ * tr("%1 file", "%1 files", count).arg(count)
14 */
15 QString UbuntuI18n::tr(const QString &singular, const QString &plural, int n)
16 {
17@@ -191,7 +193,7 @@
18 /*!
19 * \qmlmethod string i18n::dtr(string domain, string singular, string plural, int n)
20 * Translate the given text using gettext. Should be called like this:
21- * tr(domain, "%n file", "%n files", count)
22+ * tr(domain, "%1 file", "%1 files", count).arg(count)
23 * Uses \a domain for the domain instead of i18n.domain, and \a singular or \a plural
24 * as input for the translation depending on the number of items \a n.
25 */

Subscribers

People subscribed via source and target branches