emacs-devel
[Top][All Lists]
Advanced

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

Re: Before l10n, better practices for (message) ?


From: Tino Calancha
Subject: Re: Before l10n, better practices for (message) ?
Date: Tue, 23 May 2017 09:59:01 +0900 (JST)
User-agent: Alpine 2.20 (DEB 67 2015-01-07)



On Tue, 23 May 2017, Jean-Christophe Helary wrote:

I just bumped into an English/code bug this morning. In package.el, when 1 
package is not needed anymore, the message is:

"Package menu: Operation finished.  1 packages are no longer needed, type ‘M-x 
package-autoremove’ to remove them"


The error comes from the following (message) on line 3273

(message "Package menu: Operation finished.  %d packages %s"
        (length removable)
        (substitute-command-keys
                "are no longer needed, type `\\[package-autoremove]' to remove 
them"))

So I'm asking whether do we have "best practices" for using messages...
This was discussed in
https://lists.gnu.org/archive/html/emacs-devel/2016-09/msg00502.html

I proposed to add a simple function `string-plural-s' to standarize those
plurarizations.


Using such `string-plural-s' in your package example:

(let* ((options '("foo"))
       (num (length options)))
  (message
   "Package menu: Operation finished.  %d %s %s no longer needed, \
type ‘M-x package-autoremove’ to remove %s"
   num (string-plural-s num "package" "packages")
   (string-plural-s options "is" "are")
   (string-plural-s num "it" "them")))
=> "Package menu: Operation finished.  1 package is no longer needed, type ‘M-x 
package-autoremove’ to remove it"


(let* ((options '("foo" "bar" "baz"))
       (num (length options)))
  (message
   "Package menu: Operation finished.  %d %s %s no longer needed, \
type ‘M-x package-autoremove’ to remove %s"
   num (string-plural-s num "package" "packages")
   (string-plural-s num "is" "are")
   (string-plural-s options "it" "them")))
=> "Package menu: Operation finished.  3 packages are no longer needed, type ‘M-x 
package-autoremove’ to remove them"


Then, the thread somehow evolved with more sophisticated
multilingual suggestions, which caused my head spin like
the girl in 'The exorcist' movie.
It would be good to have an standard way to handle these issues.

reply via email to

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