1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

i18n: Add function ngettext for pluralization.

* lisp/international/mule-cmds.el (ngettext): New function.
https://lists.gnu.org/archive/html/emacs-devel/2019-03/msg00586.html

* lisp/replace.el (flush-lines, how-many, occur-1, occur-engine)
(perform-replace): Use ngettext.

* lisp/progmodes/grep.el (grep-exit-message): Use ngettext.
(grep-mode-font-lock-keywords): Match both singular and plural form
of "matches".
This commit is contained in:
Juri Linkov 2019-03-24 23:55:07 +02:00
parent 36535caf96
commit 5fdf4fc07d
4 changed files with 54 additions and 23 deletions

View file

@ -459,7 +459,7 @@ abbreviated part can also be toggled with
;; remove match from grep-regexp-alist before fontifying
("^Grep[/a-zA-Z]* started.*"
(0 '(face nil compilation-message nil help-echo nil mouse-face nil) t))
("^Grep[/a-zA-Z]* finished with \\(?:\\(\\(?:[0-9]+ \\)?matches found\\)\\|\\(no matches found\\)\\).*"
("^Grep[/a-zA-Z]* finished with \\(?:\\(\\(?:[0-9]+ \\)?match\\(?:es\\)? found\\)\\|\\(no matches found\\)\\).*"
(0 '(face nil compilation-message nil help-echo nil mouse-face nil) t)
(1 compilation-info-face nil t)
(2 compilation-warning-face nil t))
@ -552,7 +552,10 @@ Set up `compilation-exit-message-function' and run `grep-setup-hook'."
;; so the buffer is still unmodified if there is no output.
(cond ((and (zerop code) (buffer-modified-p))
(if (> grep-num-matches-found 0)
(cons (format "finished with %d matches found\n" grep-num-matches-found)
(cons (format (ngettext "finished with %d match found\n"
"finished with %d matches found\n"
grep-num-matches-found)
grep-num-matches-found)
"matched")
'("finished with matches found\n" . "matched")))
((not (buffer-modified-p))