From: Juri Linkov <juri@linkov.net>
To: Richard Stallman <rms@gnu.org>
Cc: 34520@debbugs.gnu.org, jidanni@jidanni.org
Subject: bug#34520: delete-matching-lines should report how many lines it deleted
Date: Sat, 02 Mar 2019 22:55:52 +0200 [thread overview]
Message-ID: <871s3p0zdz.fsf@mail.linkov.net> (raw)
In-Reply-To: <E1gzZKP-0000kS-Iw@fencepost.gnu.org> (Richard Stallman's message of "Thu, 28 Feb 2019 22:59:17 -0500")
> > Ok, waiting for the times when ‘gettext’ will arrive to Emacs.
>
> It would be very desirable to make Emacs support gettext-style
> translations. I have a feeling that it can't use the same
> code as gettext -- but with all of Emacs's other facilities,
> I think that transposing the useful part of gettext into
> Emacs won't be a big job.
>
> Would someone like to do this?
Emacs can do much better job of text translation than gettext.
It's easy to translate text transparently to the caller,
i.e. without changing the caller code at all, by adding
a new intermediate layer to some text output functions
that will translate their string arguments to the
language of the default language environment.
Here is an experimental but extensible implementation
that handles the case of formatting the recently added message
taking into account grammatical number of its argument:
(defvar i18n-translations-hash (make-hash-table :test 'equal))
(defun i18n-add-translation (_language-environment from to)
(puthash from to i18n-translations-hash))
(i18n-add-translation
"English"
"Deleted %d matching lines"
(lambda (format-string count)
(if (= count 1)
"Deleted %d matching line"
"Deleted %d matching lines")))
(defun i18n-get-translation (format-string &rest args)
(pcase (gethash format-string i18n-translations-hash)
((and (pred functionp) f) (apply f format-string args))
((and (pred stringp) s) s)
(_ format-string)))
(advice-add 'message :around
(lambda (orig-fun format-string &rest args)
(apply orig-fun (apply 'i18n-get-translation format-string args) args))
'((name . message-i18n)))
In addition to translating format strings of the function 'message',
doing the same for more text output functions like 'describe-function',
'describe-variable' and 'menu-item' in 'define-key' would cover most
of the internationalization needs.
next prev parent reply other threads:[~2019-03-02 20:55 UTC|newest]
Thread overview: 153+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-18 0:35 bug#34520: delete-matching-lines should report how many lines it deleted 積丹尼 Dan Jacobson
2019-02-18 6:06 ` Marcin Borkowski
2019-02-27 21:36 ` Juri Linkov
2019-02-28 3:34 ` Eli Zaretskii
2019-02-28 21:33 ` Juri Linkov
2019-03-01 3:59 ` Richard Stallman
2019-03-02 20:55 ` Juri Linkov [this message]
2019-03-02 23:39 ` Drew Adams
2019-03-03 3:04 ` Richard Stallman
2019-03-03 15:31 ` Emacs i18n (was: bug#34520: delete-matching-lines should report how many lines it deleted) Eli Zaretskii
2019-03-03 20:57 ` Emacs i18n Juri Linkov
2019-03-04 1:46 ` Jean-Christophe Helary
2019-03-06 9:38 ` Elias Mårtenson
2019-03-06 11:23 ` Jean-Christophe Helary
2019-03-21 20:33 ` Clément Pit-Claudel
2019-03-21 20:50 ` Eli Zaretskii
2019-03-21 21:03 ` Clément Pit-Claudel
2019-03-21 21:21 ` Jean-Christophe Helary
2019-03-21 21:34 ` Clément Pit-Claudel
2019-03-21 21:56 ` Jean-Christophe Helary
2019-03-21 22:05 ` Clément Pit-Claudel
2019-03-21 23:46 ` Jean-Christophe Helary
2019-03-22 8:22 ` Eli Zaretskii
2019-03-22 16:10 ` Clément Pit-Claudel
2019-03-22 16:35 ` Eli Zaretskii
2019-03-22 17:16 ` Clément Pit-Claudel
2019-03-22 17:35 ` Eli Zaretskii
2019-03-22 23:17 ` Clément Pit-Claudel
2019-03-21 21:17 ` Jean-Christophe Helary
2019-03-21 21:59 ` Juri Linkov
2019-03-22 8:22 ` Eli Zaretskii
2019-03-23 21:50 ` Juri Linkov
2019-03-24 3:36 ` Eli Zaretskii
2019-03-24 21:55 ` Juri Linkov
2019-03-24 23:31 ` Jean-Christophe Helary
2019-03-25 21:32 ` Juri Linkov
2019-03-25 22:31 ` Paul Eggert
2019-03-26 16:11 ` Eli Zaretskii
2019-03-26 16:22 ` Stefan Monnier
2019-03-26 16:55 ` Eli Zaretskii
2019-03-26 22:35 ` Paul Eggert
2019-03-27 3:43 ` Eli Zaretskii
2019-03-28 14:56 ` Clément Pit-Claudel
2019-03-28 15:52 ` Eli Zaretskii
2019-03-27 2:34 ` Jean-Christophe Helary
2019-03-26 23:16 ` Juri Linkov
2019-03-27 1:35 ` Paul Eggert
2019-04-24 6:39 ` Jean-Christophe Helary
2019-04-24 20:18 ` Juri Linkov
2019-03-25 3:35 ` Eli Zaretskii
2019-03-25 9:04 ` Jean-Christophe Helary
2019-03-25 21:02 ` Juri Linkov
2019-03-26 3:27 ` Eli Zaretskii
2019-03-27 23:06 ` Richard Stallman
2019-03-25 10:52 ` Mattias Engdegård
2019-03-25 15:37 ` Eli Zaretskii
2019-03-25 21:11 ` Juri Linkov
2019-03-25 22:05 ` Mattias Engdegård
2019-03-27 21:22 ` Juri Linkov
2019-03-28 11:03 ` Mattias Engdegård
2019-03-04 3:27 ` Emacs i18n (was: bug#34520: delete-matching-lines should report how many lines it deleted) Richard Stallman
2019-03-04 16:36 ` Eli Zaretskii
2019-03-04 18:37 ` Paul Eggert
2019-03-04 19:07 ` Eli Zaretskii
2019-03-05 2:09 ` Paul Eggert
2019-03-05 21:58 ` Emacs i18n Juri Linkov
2019-03-06 2:16 ` Richard Stallman
2019-03-06 18:15 ` Eli Zaretskii
2019-03-06 19:47 ` Paul Eggert
2019-03-06 20:19 ` Eli Zaretskii
2019-03-07 1:52 ` Paul Eggert
2019-03-07 3:37 ` Eli Zaretskii
2019-03-08 4:07 ` Richard Stallman
2019-03-08 8:16 ` Eli Zaretskii
2019-03-08 4:07 ` Richard Stallman
2019-03-08 4:33 ` Elias Mårtenson
2019-03-08 8:22 ` Eli Zaretskii
2019-03-09 3:11 ` Richard Stallman
2019-03-09 7:54 ` Paul Eggert
2019-03-09 10:30 ` Eli Zaretskii
2019-03-10 3:05 ` Richard Stallman
2019-03-10 6:07 ` Paul Eggert
2019-03-11 1:20 ` Richard Stallman
2019-03-11 3:52 ` Paul Eggert
2019-03-12 3:31 ` Richard Stallman
2019-03-12 3:31 ` Richard Stallman
2019-03-10 8:45 ` Yuri Khan
2019-03-10 3:05 ` Richard Stallman
2019-03-10 6:14 ` Paul Eggert
2019-03-10 3:05 ` Richard Stallman
2019-03-07 3:42 ` Richard Stallman
2019-03-07 14:46 ` Eli Zaretskii
2019-03-07 17:19 ` Paul Eggert
2019-03-07 18:24 ` martin rudalics
2019-03-07 18:44 ` Paul Eggert
2019-03-07 20:22 ` Eli Zaretskii
2019-03-07 22:25 ` Paul Eggert
2019-03-08 7:29 ` Eli Zaretskii
2019-03-08 4:18 ` Richard Stallman
2019-03-08 4:11 ` Richard Stallman
2019-03-06 17:30 ` Eli Zaretskii
2019-03-06 18:09 ` Eli Zaretskii
2019-03-06 19:39 ` Paul Eggert
2019-03-06 19:49 ` Eli Zaretskii
2019-03-07 1:33 ` Paul Eggert
2019-03-07 3:30 ` Eli Zaretskii
2019-03-07 16:06 ` Paul Eggert
2019-03-07 4:35 ` Jean-Christophe Helary
2019-03-07 16:04 ` Paul Eggert
2019-03-08 4:09 ` Richard Stallman
2019-03-11 21:48 ` Juri Linkov
2019-03-11 22:51 ` Paul Eggert
2019-03-12 21:45 ` Juri Linkov
2019-03-17 21:23 ` Juri Linkov
2019-03-18 21:20 ` Juri Linkov
2019-03-18 21:55 ` Paul Eggert
2019-03-19 20:40 ` Juri Linkov
2019-03-11 23:59 ` Jean-Christophe Helary
2019-03-12 9:16 ` Michael Albinus
2019-03-06 19:47 ` Paul Eggert
2019-03-06 20:21 ` Eli Zaretskii
2019-03-07 1:43 ` Paul Eggert
2019-03-07 3:31 ` Eli Zaretskii
2019-03-07 3:44 ` Richard Stallman
2019-03-07 14:48 ` Eli Zaretskii
2019-03-07 22:29 ` Juri Linkov
2019-03-08 1:48 ` Jean-Christophe Helary
2019-03-08 8:08 ` Eli Zaretskii
2019-03-08 15:11 ` Jean-Christophe Helary
2019-03-08 20:11 ` Eli Zaretskii
2019-03-09 2:44 ` Jean-Christophe Helary
2019-03-09 6:40 ` Eli Zaretskii
2019-03-09 8:37 ` Michael Albinus
2019-03-09 10:45 ` Eli Zaretskii
2019-03-09 11:27 ` Michael Albinus
2019-03-09 17:23 ` Eli Zaretskii
2019-03-09 19:55 ` Paul Eggert
2019-03-09 20:07 ` Eli Zaretskii
2019-03-09 20:47 ` Paul Eggert
2019-03-09 20:04 ` Michael Albinus
2019-03-09 20:14 ` Eli Zaretskii
2019-03-09 19:22 ` Paul Eggert
2019-03-09 19:39 ` Eli Zaretskii
2019-03-09 20:48 ` Paul Eggert
2019-03-09 20:08 ` Michael Albinus
2019-03-10 3:09 ` Richard Stallman
2019-03-10 13:38 ` Eli Zaretskii
2019-03-08 7:37 ` Eli Zaretskii
2019-03-09 3:12 ` Richard Stallman
2019-03-08 4:11 ` Richard Stallman
2019-03-06 2:09 ` Emacs i18n (was: bug#34520: delete-matching-lines should report how many lines it deleted) Richard Stallman
2019-03-05 2:49 ` Richard Stallman
2019-03-05 3:31 ` Eli Zaretskii
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=871s3p0zdz.fsf@mail.linkov.net \
--to=juri@linkov.net \
--cc=34520@debbugs.gnu.org \
--cc=jidanni@jidanni.org \
--cc=rms@gnu.org \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.