GNU bug report logs - #35981
[PATCH] Use ngettext in `count-lines-page'

Previous Next

Package: emacs;

Reported by: Stefan Kangas <stefan <at> marxist.se>

Date: Wed, 29 May 2019 09:35:02 UTC

Severity: minor

Tags: patch

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 35981 in the body.
You can then email your comments to 35981 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#35981; Package emacs. (Wed, 29 May 2019 09:35:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefan Kangas <stefan <at> marxist.se>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 29 May 2019 09:35:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Use ngettext in `count-lines-page'
Date: Wed, 29 May 2019 11:34:12 +0200
[Message part 1 (text/plain, inline)]
See attached patch to correctly use ngettext in `count-lines-page' to get
pluralization.

Thanks,
Stefan Kangas
[0001-Use-ngettext-in-count-lines-page.patch (application/octet-stream, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35981; Package emacs. (Wed, 29 May 2019 11:42:02 GMT) Full text and rfc822 format available.

Message #8 received at 35981 <at> debbugs.gnu.org (full text, mbox):

From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: 35981 <at> debbugs.gnu.org
Subject: Re: bug#35981: [PATCH] Use ngettext in `count-lines-page'
Date: Wed, 29 May 2019 12:41:42 +0100
[Message part 1 (text/plain, inline)]
severity 35981 minor
quit

> From 93092aa18ca4348d14c3154a6ffbdfc535536cba Mon Sep 17 00:00:00 2001
> From: Stefan Kangas <stefankangas <at> gmail.com>
> Date: Wed, 29 May 2019 11:27:22 +0200
> Subject: [PATCH] Use ngettext in `count-lines-page'
>
> * textmodes/page.el (count-lines-page): Use ngettext.
> ---
>  lisp/textmodes/page.el | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/lisp/textmodes/page.el b/lisp/textmodes/page.el
> index 220ef2d7fd..1379880374 100644
> --- a/lisp/textmodes/page.el
> +++ b/lisp/textmodes/page.el
> @@ -142,7 +142,10 @@ count-lines-page
>        (setq total (count-lines beg end)
>  	    before (count-lines beg opoint)
>  	    after (count-lines opoint end))
> -      (message "Page has %d lines (%d + %d)" total before after))))
> +      (message "Page has %s (%d + %d)"
> +               (format-message (ngettext "%d line" "%d lines" total) total)
> +               before
> +               after))))

I don't think it's right to split the phrase into two parts "Page has"
and "N lines" for i18n purposes.  How about the following instead:

[page.diff (text/x-diff, inline)]
diff --git a/lisp/textmodes/page.el b/lisp/textmodes/page.el
index 220ef2d7fd..d7214f610f 100644
--- a/lisp/textmodes/page.el
+++ b/lisp/textmodes/page.el
@@ -142,7 +142,8 @@ count-lines-page
       (setq total (count-lines beg end)
 	    before (count-lines beg opoint)
 	    after (count-lines opoint end))
-      (message "Page has %d lines (%d + %d)" total before after))))
+      (let ((fmt (ngettext "Page has %d line" "Page has %d lines" total)))
+        (message "%s (%d + %d)" (format-message fmt total) before after)))))
 
 (defun what-page ()
   "Print page and line number of point."
[Message part 3 (text/plain, inline)]
Thanks,

-- 
Basil

Severity set to 'minor' from 'normal' Request was from "Basil L. Contovounesios" <contovob <at> tcd.ie> to control <at> debbugs.gnu.org. (Wed, 29 May 2019 11:42:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35981; Package emacs. (Wed, 29 May 2019 11:47:01 GMT) Full text and rfc822 format available.

Message #13 received at 35981 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: "Basil L. Contovounesios" <contovob <at> tcd.ie>
Cc: 35981 <at> debbugs.gnu.org
Subject: Re: bug#35981: [PATCH] Use ngettext in `count-lines-page'
Date: Wed, 29 May 2019 13:46:19 +0200
Basil L. Contovounesios <contovob <at> tcd.ie> writes:
> How about the following instead:

Looks good to me.

Thanks,
Stefan Kangas




Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Mon, 10 Jun 2019 00:05:01 GMT) Full text and rfc822 format available.

Notification sent to Stefan Kangas <stefan <at> marxist.se>:
bug acknowledged by developer. (Mon, 10 Jun 2019 00:05:02 GMT) Full text and rfc822 format available.

Message #18 received at 35981-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: "Basil L. Contovounesios" <contovob <at> tcd.ie>, 35981-done <at> debbugs.gnu.org
Subject: Re: [PATCH] Use ngettext in `count-lines-page'
Date: Sun, 9 Jun 2019 17:03:52 -0700
[Message part 1 (text/plain, inline)]
When a diagnostic this short it's typically more straightforward to give 
the translators the whole diagnostic than to ask them to figure out how 
it's pieced together and to restrict their translations algorithmically, 
so I installed the attached patch instead. Thanks for reporting the problem.

[0001-Fig-grammar-of-count-lines-page.patch (text/x-patch, attachment)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 08 Jul 2019 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 6 years and 67 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.