unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#35981: [PATCH] Use ngettext in `count-lines-page'
@ 2019-05-29  9:34 Stefan Kangas
  2019-05-29 11:41 ` Basil L. Contovounesios
  2019-06-10  0:03 ` Paul Eggert
  0 siblings, 2 replies; 4+ messages in thread
From: Stefan Kangas @ 2019-05-29  9:34 UTC (permalink / raw)
  To: 35981

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

See attached patch to correctly use ngettext in `count-lines-page' to get
pluralization.

Thanks,
Stefan Kangas

[-- Attachment #2: 0001-Use-ngettext-in-count-lines-page.patch --]
[-- Type: application/octet-stream, Size: 970 bytes --]

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))))
 
 (defun what-page ()
   "Print page and line number of point."
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#35981: [PATCH] Use ngettext in `count-lines-page'
  2019-05-29  9:34 bug#35981: [PATCH] Use ngettext in `count-lines-page' Stefan Kangas
@ 2019-05-29 11:41 ` Basil L. Contovounesios
  2019-05-29 11:46   ` Stefan Kangas
  2019-06-10  0:03 ` Paul Eggert
  1 sibling, 1 reply; 4+ messages in thread
From: Basil L. Contovounesios @ 2019-05-29 11:41 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 35981

[-- 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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#35981: [PATCH] Use ngettext in `count-lines-page'
  2019-05-29 11:41 ` Basil L. Contovounesios
@ 2019-05-29 11:46   ` Stefan Kangas
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Kangas @ 2019-05-29 11:46 UTC (permalink / raw)
  To: Basil L. Contovounesios; +Cc: 35981

Basil L. Contovounesios <contovob@tcd.ie> writes:
> How about the following instead:

Looks good to me.

Thanks,
Stefan Kangas





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#35981: [PATCH] Use ngettext in `count-lines-page'
  2019-05-29  9:34 bug#35981: [PATCH] Use ngettext in `count-lines-page' Stefan Kangas
  2019-05-29 11:41 ` Basil L. Contovounesios
@ 2019-06-10  0:03 ` Paul Eggert
  1 sibling, 0 replies; 4+ messages in thread
From: Paul Eggert @ 2019-06-10  0:03 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: Basil L. Contovounesios, 35981-done

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

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.


[-- Attachment #2: 0001-Fig-grammar-of-count-lines-page.patch --]
[-- Type: text/x-patch, Size: 979 bytes --]

From bcea7e843936da41619df67faedf5f508db7d722 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@Penguin.CS.UCLA.EDU>
Date: Sun, 9 Jun 2019 16:59:43 -0700
Subject: [PATCH] Fig grammar of count-lines-page

* lisp/textmodes/page.el (count-lines-page):
Say "Page has 1 line", not "Page has 1 lines" (Bug#35981).
---
 lisp/textmodes/page.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/textmodes/page.el b/lisp/textmodes/page.el
index 2b0cea4c64..8921b697f3 100644
--- a/lisp/textmodes/page.el
+++ b/lisp/textmodes/page.el
@@ -141,7 +141,9 @@ 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 (ngettext "Page has %d line (%d + %d)"
+			 "Page has %d lines (%d + %d)" total)
+	       total before after))))
 
 (defun what-page ()
   "Print page and line number of point."
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-06-10  0:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-29  9:34 bug#35981: [PATCH] Use ngettext in `count-lines-page' Stefan Kangas
2019-05-29 11:41 ` Basil L. Contovounesios
2019-05-29 11:46   ` Stefan Kangas
2019-06-10  0:03 ` Paul Eggert

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