Merge lp:~dobey/unity-scope-click/plural-results into lp:unity-scope-click/devel

Proposed by dobey
Status: Merged
Approved by: Alejandro J. Cura
Approved revision: 351
Merged at revision: 351
Proposed branch: lp:~dobey/unity-scope-click/plural-results
Merge into: lp:unity-scope-click/devel
Diff against target: 105 lines (+22/-14)
3 files modified
po/unity-scope-click.pot (+14/-11)
scope/clickstore/store-query.cpp (+6/-1)
scope/tests/test_query.cpp (+2/-2)
To merge this branch: bzr merge lp:~dobey/unity-scope-click/plural-results
Reviewer Review Type Date Requested Status
Alejandro J. Cura (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+227633@code.launchpad.net

Commit message

Use dngettext to have the results string be pluralized.

To post a comment you must log in.
Revision history for this message
Alejandro J. Cura (alecu) wrote :

Why do you need to remove the checks with CategoryHasNumberOfResults?

review: Needs Information
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
dobey (dobey) wrote :

On Mon, 2014-07-21 at 21:49 +0000, Alejandro J. Cura wrote:
> Review: Needs Information
>
> Why do you need to remove the checks with CategoryHasNumberOfResults?

I removed them from the two tests for testing the Purchased flag,
because those tests should not be testing the category results string,
but only data related to purchasing. I should have done this in the
branch that added those tests, but didn't notice it until I broke the
tests when creating this branch. So I removed them here.

Revision history for this message
Alejandro J. Cura (alecu) wrote :

Looks good

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'po/unity-scope-click.pot'
2--- po/unity-scope-click.pot 2014-07-18 13:35:58 +0000
3+++ po/unity-scope-click.pot 2014-07-21 20:51:07 +0000
4@@ -8,7 +8,7 @@
5 msgstr ""
6 "Project-Id-Version: PACKAGE VERSION\n"
7 "Report-Msgid-Bugs-To: \n"
8-"POT-Creation-Date: 2014-07-18 09:34-0400\n"
9+"POT-Creation-Date: 2014-07-21 16:42-0400\n"
10 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
11 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
12 "Language-Team: LANGUAGE <LL@li.org>\n"
13@@ -16,6 +16,7 @@
14 "MIME-Version: 1.0\n"
15 "Content-Type: text/plain; charset=UTF-8\n"
16 "Content-Transfer-Encoding: 8bit\n"
17+"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
18
19 #: ../data/com.canonical.scopes.clickstore.ini.in.in.h:1
20 #: ../scope/clickapps/apps-query.cpp:258
21@@ -105,32 +106,34 @@
22 msgstr ""
23
24 #: ../scope/clickapps/apps-query.cpp:297
25-#: ../scope/clickstore/store-query.cpp:234
26-#: ../scope/clickstore/store-query.cpp:245
27+#: ../scope/clickstore/store-query.cpp:236
28+#: ../scope/clickstore/store-query.cpp:247
29 msgid "All departments"
30 msgstr ""
31
32-#: ../scope/clickstore/store-query.cpp:283
33+#: ../scope/clickstore/store-query.cpp:285
34 msgid "✔ INSTALLED"
35 msgstr ""
36
37-#: ../scope/clickstore/store-query.cpp:288
38+#: ../scope/clickstore/store-query.cpp:290
39 msgid "✔ PURCHASED"
40 msgstr ""
41
42-#: ../scope/clickstore/store-query.cpp:292
43+#: ../scope/clickstore/store-query.cpp:298
44 msgid "FREE"
45 msgstr ""
46
47-#: ../scope/clickstore/store-query.cpp:401
48+#: ../scope/clickstore/store-query.cpp:408
49 msgid "Available"
50 msgstr ""
51
52-#: ../scope/clickstore/store-query.cpp:404
53+#: ../scope/clickstore/store-query.cpp:414
54 #, c-format
55-msgid "%u results in Ubuntu Store"
56-msgstr ""
57+msgid "%u result in Ubuntu Store"
58+msgid_plural "%u results in Ubuntu Store"
59+msgstr[0] ""
60+msgstr[1] ""
61
62-#: ../scope/clickstore/store-query.cpp:412
63+#: ../scope/clickstore/store-query.cpp:424
64 msgid "Recommended"
65 msgstr ""
66
67=== modified file 'scope/clickstore/store-query.cpp'
68--- scope/clickstore/store-query.cpp 2014-07-17 21:35:57 +0000
69+++ scope/clickstore/store-query.cpp 2014-07-21 20:51:07 +0000
70@@ -408,7 +408,12 @@
71 std::string cat_title(_("Available"));
72 {
73 char tmp[512];
74- if (snprintf(tmp, sizeof(tmp), _("%u results in Ubuntu Store"), static_cast<unsigned int>(packages.size())) > 0) {
75+ unsigned int num_results = static_cast<unsigned int>(packages.size());
76+ if (snprintf(tmp, sizeof(tmp),
77+ dngettext(GETTEXT_PACKAGE,
78+ "%u result in Ubuntu Store",
79+ "%u results in Ubuntu Store",
80+ num_results), num_results) > 0) {
81 cat_title = tmp;
82 }
83 }
84
85=== modified file 'scope/tests/test_query.cpp'
86--- scope/tests/test_query.cpp 2014-07-18 15:01:41 +0000
87+++ scope/tests/test_query.cpp 2014-07-21 20:51:07 +0000
88@@ -408,7 +408,7 @@
89 auto ptrCat = std::make_shared<FakeCategory>("id", "", "", renderer);
90
91 ON_CALL(q, register_category(_, _, _, _, _)).WillByDefault(Return(ptrCat));
92- EXPECT_CALL(q, register_category(_, "appstore", CategoryHasNumberOfResults(1), _, _));
93+ EXPECT_CALL(q, register_category(_, "appstore", _, _, _));
94 EXPECT_CALL(q, register_category(_, "recommends", _, _, _));
95
96 scopes::testing::MockSearchReply mock_reply;
97@@ -443,7 +443,7 @@
98 auto ptrCat = std::make_shared<FakeCategory>("id", "", "", renderer);
99
100 ON_CALL(q, register_category(_, _, _, _, _)).WillByDefault(Return(ptrCat));
101- EXPECT_CALL(q, register_category(_, "appstore", CategoryHasNumberOfResults(1), _, _));
102+ EXPECT_CALL(q, register_category(_, "appstore", _, _, _));
103 EXPECT_CALL(q, register_category(_, "recommends", _, _, _));
104
105 scopes::testing::MockSearchReply mock_reply;

Subscribers

People subscribed via source and target branches

to all changes: