From: Juri Linkov Date: Sun, 5 May 2019 19:43:27 +0000 (+0300) Subject: Use ngettext instead of dired-plural-s in Dired (bug#35287) X-Git-Tag: emacs-27.0.90~2962 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=7bba702e1ad1ed343618e44cf5bbc2a1f079be0c;p=emacs.git Use ngettext instead of dired-plural-s in Dired (bug#35287) * lisp/dired-aux.el (dired-map-over-marks-check): Use ngettext instead of dired-plural-s. (dired-create-files): Also add colon after operation name. (dired-compare-directories): Use ngettext and format-message. (dired-do-compress-to): Use ngettext. * lisp/dired.el (dired-internal-do-deletions) (dired-clean-up-after-deletion): Use ngettext instead of dired-plural-s. --- diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index b81c0d1a4f5..0cf9e6e2e91 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -246,9 +246,11 @@ Examples of PREDICATE: (lambda () (dired-mark-if (member (dired-get-filename nil t) file-list2) nil))) - (message "Marked in dir1: %s files, in dir2: %s files" - (length file-list1) - (length file-list2)))) + (message "Marked in dir1: %s, in dir2: %s" + (format-message (ngettext "%d file" "%d files" (length file-list1)) + (length file-list1)) + (format-message (ngettext "%d file" "%d files" (length file-list2)) + (length file-list2))))) (defun dired-file-set-difference (list1 list2 predicate) "Combine LIST1 and LIST2 using a set-difference operation. @@ -1065,7 +1067,9 @@ and `dired-compress-files-alist'." (shell-quote-argument (file-name-nondirectory file-desc))) in-files " ")))))) - (message "Compressed %d file(s) to %s" + (message (ngettext "Compressed %d file to %s" + "Compressed %d files to %s" + (length in-files)) (length in-files) (file-name-nondirectory out-file))))))) @@ -1193,12 +1197,14 @@ Return nil if no change in files." (string (if (eq op-symbol 'compress) "Compress or uncompress" (capitalize (symbol-name op-symbol))))) (if (not failures) - (message "%s: %d file%s." - string total (dired-plural-s total)) + (message (ngettext "%s: %d file." "%s: %d files." total) + string total) ;; end this bunch of errors: (dired-log-summary - (format "Failed to %s %d of %d file%s" - (downcase string) count total (dired-plural-s total)) + (format (ngettext "Failed to %s %d of %d file" + "Failed to %s %d of %d files" + total) + (downcase string) count total) failures))))) ;;;###autoload @@ -1798,32 +1804,36 @@ ESC or `q' to not overwrite any of the remaining files, (progn (push (dired-make-relative from) failures) - (dired-log "%s `%s' to `%s' failed:\n%s\n" + (dired-log "%s: `%s' to `%s' failed:\n%s\n" operation from to err)))))))) (cond (dired-create-files-failures (setq failures (nconc failures dired-create-files-failures)) (dired-log-summary - (format "%s failed for %d file%s in %d requests" - operation (length failures) - (dired-plural-s (length failures)) - total) + (format (ngettext "%s failed for %d file in %d requests" + "%s failed for %d files in %d requests" + (length failures)) + operation (length failures) total) failures)) (failures (dired-log-summary - (format "%s failed for %d of %d file%s" - operation (length failures) - total (dired-plural-s total)) + (format (ngettext "%s: %d of %d file failed" + "%s: %d of %d files failed" + total) + operation (length failures) total) failures)) (skipped (dired-log-summary - (format "%s: %d of %d file%s skipped" - operation (length skipped) total - (dired-plural-s total)) + (format (ngettext "%s: %d of %d file skipped" + "%s: %d of %d files skipped" + total) + operation (length skipped) total) skipped)) (t - (message "%s: %s file%s" - operation success-count (dired-plural-s success-count))))) + (message (ngettext "%s: %d file done" + "%s: %d files done" + success-count) + operation success-count)))) (dired-move-to-filename)) (defun dired-do-create-files (op-symbol file-creator operation arg diff --git a/lisp/dired.el b/lisp/dired.el index 63082fe3927..385126514b3 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -3212,9 +3212,10 @@ non-empty directories is allowed." (if (not failures) (progress-reporter-done progress-reporter) (dired-log-summary - (format "%d of %d deletion%s failed" - (length failures) count - (dired-plural-s count)) + (format (ngettext "%d of %d deletion failed" + "%d of %d deletions failed" + count) + (length failures) count) failures))))) (message "(No deletions performed)"))) (dired-move-to-filename)) @@ -3267,8 +3268,9 @@ confirmation. To disable the confirmation, see (let ((buf-list (dired-buffers-for-dir (expand-file-name fn)))) (and buf-list (and dired-clean-confirm-killing-deleted-buffers - (y-or-n-p (format "Kill Dired buffer%s of %s, too? " - (dired-plural-s (length buf-list)) + (y-or-n-p (format (ngettext "Kill Dired buffer of %s, too? " + "Kill Dired buffers of %s, too? " + (length buf-list)) (file-name-nondirectory fn)))) (dolist (buf buf-list) (kill-buffer buf))))))