Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tmalsburg/txl.el
Emacs extension providing direct access to DeepL's machine translation API.
https://github.com/tmalsburg/txl.el
emacs language language-technology machine-translation nlp
Last synced: 19 days ago
JSON representation
Emacs extension providing direct access to DeepL's machine translation API.
- Host: GitHub
- URL: https://github.com/tmalsburg/txl.el
- Owner: tmalsburg
- License: gpl-3.0
- Created: 2020-11-05T17:50:04.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2024-10-02T05:59:04.000Z (about 1 month ago)
- Last Synced: 2024-10-12T04:16:15.427Z (about 1 month ago)
- Topics: emacs, language, language-technology, machine-translation, nlp
- Language: Emacs Lisp
- Homepage:
- Size: 25.4 KB
- Stars: 39
- Watchers: 3
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.org
- License: LICENSE
Awesome Lists containing this project
README
* TXL – High-quality machine translation in Emacs via DeepL’s REST API
TXL provides machine translation through DeepL's REST API.** Installation
TXL is available on [[https://melpa.org/#/txl][MELPA]]. If you’re using [[https://github.com/raxod502/straight.el][straight.el]] as your package manager, you can also install directly from this repo using:#+BEGIN_SRC elisp
(straight-use-package
'(txl :type git :host github :repo "tmalsburg/txl.el"))
#+END_SRCDependencies are:
- [[https://github.com/tmalsburg/guess-language.el][guess-language.el]] (available on [[http://elpa.gnu.org/packages/guess-language.html][ELPA]])
- [[https://github.com/tkf/emacs-request][request.el]] (available on [[https://melpa.org/#/request][MELPA]])** Configuration
Minimally, the user needs to specify a pair of languages in the customization variable ~txl-languages~ and an authentication key for DeepL's REST API via ~txl-deepl-api-url~. (You need the [[https://www.deepl.com/pro?cta=menu-plans/][“developer” subscription]].) Example:#+BEGIN_SRC elisp
(require 'txl)
(setq txl-languages '(DE . EN-US))
(setq txl-deepl-api-key "my-api-key")
#+END_SRCBy default, txl.el assumes that your key is for the DeepL Pro plan. When the free plan is used instead, txl.el needs to use a different API URL. The following definition sets this URL:
#+BEGIN_SRC elisp
(setq txl-deepl-api-url "https://api-free.deepl.com/v2/translate")
#+END_SRCOther configuration variables are ~txl-deelp-split-sentences~, ~txl-deepl-preserve-formatting~, and ~txl-deepl-formality~. See inline documentation for details.
For convenience the translation command can be bound to a keyboard shortcut. Example:
#+BEGIN_SRC elisp
(global-set-key (kbd "C-x t") 'txl-translate-region-or-paragraph)
#+END_SRC** Usage
The command ~txl-translate-region-or-paragraph~ translates the marked region or, if no region is active, the paragraph to the respective other language. The current language is detected using the ~guess-language~ package. The retrieved translation is shown in a separate buffer where it can be reviewed and edited. The original text can be replaced with the (edited) translation via ~C-c C-c~. The translation can be dismissed (without touching the original text) using ~C-c C-k~. If a prefix argument is given (~C-u~), the text will be translated round-trip to the other language and back.** License
This package is published under the GNU GENERAL PUBLIC LICENSE version 3.