unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Basil L. Contovounesios" <contovob@tcd.ie>
To: Stefan Kangas <stefan@marxist.se>
Cc: 35981@debbugs.gnu.org
Subject: bug#35981: [PATCH] Use ngettext in `count-lines-page'
Date: Wed, 29 May 2019 12:41:42 +0100	[thread overview]
Message-ID: <87sgsxfpxl.fsf@tcd.ie> (raw)
In-Reply-To: <CADwFkmnnnvaimo2hc=pZtFRkOfuky5KZLq=ueFgFgh3mQX2Kpw@mail.gmail.com> (Stefan Kangas's message of "Wed, 29 May 2019 11:34:12 +0200")

[-- Attachment #1: Type: text/plain, Size: 1104 bytes --]

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:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: page.diff --]
[-- Type: text/x-diff, Size: 597 bytes --]

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

[-- Attachment #3: Type: text/plain, Size: 20 bytes --]


Thanks,

-- 
Basil

  reply	other threads:[~2019-05-29 11:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-29  9:34 bug#35981: [PATCH] Use ngettext in `count-lines-page' Stefan Kangas
2019-05-29 11:41 ` Basil L. Contovounesios [this message]
2019-05-29 11:46   ` Stefan Kangas
2019-06-10  0:03 ` Paul Eggert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sgsxfpxl.fsf@tcd.ie \
    --to=contovob@tcd.ie \
    --cc=35981@debbugs.gnu.org \
    --cc=stefan@marxist.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).