QiangF / lingva

GNU General Public License v3.0
0 stars 0 forks source link

This is a basic Emacs interface to the [[https://lingva.ml][lingva.ml]] API, which allows you to obtain translations of texts from Google Translate without any tracking.

The entry point is =lingva-translate=, which will translate between =lingva-source= and =lingva-target= by default. The text to be translated is, in order, the region if active (also works in =pdf-view-mode=), or else the word at point, or else what the user inputs.

Called with a single prefix argument, it will prompt the user for a source language. Called with two prefix arguments, it prompts for both a source and a target language. The default source language is to auto-detect, the default target language is English. You can customize the values of both =lingva-source= and =lingva-target=.

The translated text appears in a temporary buffer and is also copied to the kill ring/clipboard.

To choose which lingva instance to interact with, customize =lingva-instance=. It might be a good idea to switch it to something other than the official one if it gets overwhelmed (a list is available here: [[https://github.com/TheDavidDelta/lingva-translate#instances][lingva-translate instances]]).

For now the list of supported languages is what is returned by the official [[https://lingva.ml][lingva.ml]] instance's API. It can be obtained/updated by running =lingva-update-lingva-languages=.

** install

=lingva.el= is available on MELPA. If you already have it set up you can call =M-x package-install RET lingva=.

** similar projects

You may also be interested in [[https://codeberg.org/martianh/libretrans.el][libretrans.el]].

There is a fully-featured Google Translate package for emacs: https://github.com/atykhonov/google-translate. There is also a translation framework that supports Google, Bing, and deepL: https://github.com/lorniu/go-translate. They might be useful if you need to access more aspects of the API, as the lingva version is bare-bones and only returns the translated text.