https://github.com/honmaple/emacs-maple-translate
Translate word between chinese and english.
https://github.com/honmaple/emacs-maple-translate
Last synced: about 1 year ago
JSON representation
Translate word between chinese and english.
- Host: GitHub
- URL: https://github.com/honmaple/emacs-maple-translate
- Owner: honmaple
- Created: 2023-09-26T13:42:54.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2025-02-08T09:09:49.000Z (over 1 year ago)
- Last Synced: 2025-02-14T17:43:04.523Z (over 1 year ago)
- Language: Emacs Lisp
- Homepage:
- Size: 72.3 KB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.org
Awesome Lists containing this project
README
* emacs-maple-translate
Translate words between Chinese and English.
** Installation
#+begin_src elisp
(use-package maple-translate
:quelpa (:fetcher github :repo "honmaple/emacs-maple-translate")
:commands (maple-translate maple-translate+))
#+end_src
Or alternatively, you can download the repository and install manually by doing:
#+begin_src bash
git clone https://github.com/honmaple/emacs-maple-translate ~/.emacs.d/site-lisp/maple-translate
#+end_src
#+begin_src elisp
(use-package maple-translate
:ensure nil
:commands (maple-translate maple-translate+))
#+end_src
** Usage
In any buffer, run =M-x maple-translate= to translate the selected text or the
word at point. By default, it translates the input to Chinese, as the default
backends are for English-Chinese translation. See the Customization section for
configuring other backends.
** Customization
#+begin_src elisp
(setq maple-translate-engine 'youdao)
;; or use multi engines
(setq maple-translate-engine '(youdao dictcn))
;; custom result with different section
(setq maple-translate-section '(phonetic basic detail morphology phrase sentence))
;; with google translate
(setq maple-translate-google-url "https://translate.googleapis.com/translate_a/single")
(setq maple-translate-google-proxies
'(("http" . "127.0.0.1:1086")
("https" . "127.0.0.1:1086")))
;; with offline sdcv
(setq maple-translate-sdcv-dir "~/.stardict/dicts")
(setq maple-translate-sdcv-dicts
'(("lazyworm-ec" . "stardict-lazyworm-ec-2.4.2")
("lazyworm-ce" . "stardict-lazyworm-ce-2.4.2")))
#+end_src
Custom different engine for special command
#+begin_src elisp
(setq maple-translate-engine-alist '((maple-translate . youdao)
(maple-translate+ . sdcv)))
#+end_src
Custom different section for special command
#+begin_src elisp
(setq maple-translate-section-alist '((maple-translate . (phonetic basic detail))))
#+end_src
Custom different display for special command
#+begin_src elisp
(setq maple-translate-display-alist '((maple-translate . maple-translate-show-in-posframe)
(maple-translate+ . maple-translate-show-in-buffer)))
#+end_src
Custom translate engine
#+begin_src elisp
(defun custom-translate-engine(text &optional callback)
(if (string= text "word")
(list (cons 'basic "单词"))
(list (cons 'basic "word"))))
(add-to-list 'maple-translate-alist '(custom . custom-translate-engine))
(setq maple-translate-engine 'custom)
#+end_src
** Offline
- [X] Sdcv
** Long sentence
- [X] Youdao
- [X] Google
** Supported Engines
- youdao
- dictcn
- iciba
- bing
- google
- sdcv