Merge lp:~azzar1/update-notifier/ngettext-livepatch into lp:update-notifier

Proposed by Andrea Azzarone on 2017-08-31
Status: Merged
Approved by: Sebastien Bacher on 2017-09-01
Approved revision: 913
Merged at revision: 913
Proposed branch: lp:~azzar1/update-notifier/ngettext-livepatch
Merge into: lp:update-notifier
Diff against target: 21 lines (+6/-5)
1 file modified
src/livepatch.c (+6/-5)
To merge this branch: bzr merge lp:~azzar1/update-notifier/ngettext-livepatch
Reviewer Review Type Date Requested Status
Sebastien Bacher 2017-08-31 Approve on 2017-09-01
Review via email: mp+329982@code.launchpad.net

Commit Message

Use ngettext to correctly handle the plural form.

To post a comment you must log in.
Sebastien Bacher (seb128) wrote :

the change makes sense, thanks

review: Approve
Colin Watson (cjwatson) :
914. By Andrea <andrea@andrea-XPS-15-9550> on 2017-09-04

Update livepatch notification text.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/livepatch.c'
2--- src/livepatch.c 2017-08-22 13:47:59 +0000
3+++ src/livepatch.c 2017-09-04 13:45:32 +0000
4@@ -70,11 +70,12 @@
5 if (!g_strcmp0 (event, "applied")) {
6 g_autofree gchar *body = NULL;
7
8- if (!g_strcmp0 (description, "1")) {
9- body = g_strdup_printf (_("A Livepatch update has been sucessfully applied"));
10- } else {
11- body = g_strdup_printf (_("%s Livepatch updates have been sucessfully applied"), description);
12- }
13+ int num_updates = atoi(description);
14+ body = g_strdup_printf(
15+ ngettext("%d Livepatch update has been successfully applied.",
16+ "%d Livepatch updates have been successfully applied.",
17+ num_updates),
18+ num_updates);
19
20 show_notification (_("Canonical Livepatch"), body, NULL);
21 }

Subscribers

People subscribed via source and target branches

to all changes: