SiteMap Search ElispArea HowTo Glossary RecentChanges News Problems Suggestions

TextTranslator

Last edit

Added:

> Great package. Already available as a package in [http://www.slitaz.org SliTaz GNU/Linux].


Text Translation package

translates the character string on Emacs. this packages use the text translation service that exists on the Internet.

Download

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.

Quick use

(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.

Configuration sample

put text-translator.el, text-translator-load.el and text-translator-vars.el to load-path.

use autoload

(require 'text-translator-load)

use require

;;;; not autoload, use require
(require 'text-translator)

change prefix key

;; set prefix-key to M-n
(setq text-translator-prefix-key "\M-n")

set global key

(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 keys to major-mode

(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)))

use proxy

;; ;; 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)

use popup-tip function

;; 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)

use translation type auto selection (english/japanese only)

;; 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)

Keys allocated to major-mode

you can see key allocation by typing prefix-key C-h on the text-translator-mode.

\C-qtext-translator-quit
\C-atext-translator-translate-recent-type
\C-ltext-translator-display-last-string
\C-dtext-translator-translate-default
\C-stext-translator-toggle-leave-string

Translation sites

Links

Comments

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.


CategoryInterface CategoryInternationalization