help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: google-translate (was: Re: Is it possible to transform text before f


From: Emanuel Berg
Subject: Re: google-translate (was: Re: Is it possible to transform text before feeding it to ispell?)
Date: Thu, 10 Sep 2015 02:51:16 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Andrey Tykhonov <atykhonov@gmail.com> writes:

> Thank you for the bug report! I'll fix it as soon
> as possible!

My pleasure :)

Here is an improvement of the interface I posted the
other day. You might want to use it or do something
similar your way. The idea is to echo the translation,
only with no properties, and not have it stick on the
kill ring.

;; This file: http://user.it.uu.se/~embe8573/conf/emacs-init/translate.el

(require 'w3m-unisearch) ; 
http://user.it.uu.se/~embe8573/conf/emacs-init/w3m/w3m-unisearch.el

(require 'google-translate-core-ui)

(defun swedish-to-english (&optional text-noninteractive)
  (interactive)
  (let ((killed kill-ring)
        (text   (or text-noninteractive (get-search-string "ord"))) )
    (google-translate-translate "Swedish" "English" text 'kill-ring)
    (let ((translation (string-make-unibyte (current-kill 0))))
      (setq kill-ring-yank-pointer killed)
      (if text-noninteractive translation
        (message "%s: %s" text translation) ))))

(defalias 'sv 'swedish-to-english)

-- 
underground experts united
http://user.it.uu.se/~embe8573




reply via email to

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