bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#35981: [PATCH] Use ngettext in `count-lines-page'


From: Basil L. Contovounesios
Subject: bug#35981: [PATCH] Use ngettext in `count-lines-page'
Date: Wed, 29 May 2019 12:41:42 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

severity 35981 minor
quit

> From 93092aa18ca4348d14c3154a6ffbdfc535536cba Mon Sep 17 00:00:00 2001
> From: Stefan Kangas <stefankangas@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:

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."
Thanks,

-- 
Basil

reply via email to

[Prev in Thread] Current Thread [Next in Thread]