Last edit
Added:
> Great package. Already available as a package in [http://www.slitaz.org SliTaz GNU/Linux].
translates the character string on Emacs. this packages use the text translation service that exists on the Internet.
or Launchpad. Launchpad version of text-translator is development version.
or
M-x auto-install-batch text translator if you have AutoInstall.
And Development new version is here.
(require 'text-translator) (global-set-key "\C-x\M-t" 'text-translator)
You can translate text selected by region with C-x M-t.
You can also specify translator engine with prefix key like C-u C-x M-t google.com_jaen RET.
put text-translator.el, text-translator-load.el and text-translator-vars.el to load-path.
(require 'text-translator-load)
;;;; not autoload, use require (require 'text-translator)
;; set prefix-key to M-n (setq text-translator-prefix-key "\M-n")
(global-set-key "\C-x\M-t" 'text-translator) (global-set-key "\C-x\M-T" 'text-translator-translate-last-string) ;; translate all sites. ;; for example, if you specify "enja", text-translator use google.com_enja, yahoo.com_enja, ... . (global-set-key "\C-x\M-a" 'text-translator-all)
(add-hook 'text-translator-mode-hook (lambda() ;; if you do not change prefix-key, it is executed by C-c M-a (define-key text-translator-mode-pkey-map "\M-a" 'text-translator-translate-recent-type)))
;; ;; if you are setting environment variables HTTP_PROXY, ;; ;; you have not to set this. ;; (setq text-translator-proxy-server "proxy.hogehoge.com") ;; (setq text-translator-proxy-port 8080)
;; The trasnlation results show the popup (text overlay). ;; You have to require the popup.el. (http://github.com/m2ym/auto-complete) (require 'popup) (setq text-translator-display-popup t)
;; set function that use auto selection
(setq text-translator-auto-selection-func
'text-translator-translate-by-auto-selection-enja)
;; set global-key
(global-set-key "\C-xt" 'text-translator-translate-by-auto-selection)
you can see key allocation by typing prefix-key C-h on the text-translator-mode.
| \C-q | text-translator-quit |
| \C-a | text-translator-translate-recent-type |
| \C-l | text-translator-display-last-string |
| \C-d | text-translator-translate-default |
| \C-s | text-translator-toggle-leave-string |
Great package. I recommend adding a function similar to M-$, which runs the command ispell-word. It would be great. Thanks!
Thank you for your comment.
I’ll think about it. – khiker
You could change to this function on text-translator it does something like what was last suggested:
(defun text-translator-region-or-thing-at-point (&optional prompt)
"If mark is active, return the region, otherwise, thing at point."
(cond
(mark-active
(buffer-substring-no-properties (region-beginning) (region-end)))
(t
(thing-at-point 'symbol ))))
Great package. Already available as a package in SliTaz GNU/Linux.