English | Русский
Cross-platform terminal user interface (TUI) based on the Blessed library for simultaneous text translation using several popular translation sources, as well as LLM via OpenAI. All sources do not require an access token (API key, with the exception of OpenAI) or other settings. Supports automatic source and target language definition at code level between English and any of the supported languages, as well as access to translation history via SQLite (up to 500 requests, after which old records from the history are automatically cleared).
- Google - free and unlimited API using serverless hosted on the Vercel platform. Available for translation more than 5000 characters.
- DeepL - free API via DeepLX using serverless hosted on Vercel platform. There are limits on the number of translation requests that can be made frequently, and there may also be a limit on the number of characters that can be used (the official limit is 5000 characters per request).
- Reverso - the most stable, free and without any limitation on the number of characters (version on the site is limited to 2000 characters and 900 in the application, through the API can get up to 8000). Does not contain official documentation, request was received from official site via DevTools.
- MyMemory - free and open API (limit of 500 characters per request). Supports up to 3 response options for short queries.
- OpenAI - translate text using LLM (you need to pass the API key via a parameter, which is saved in a file for later use).
Use the npm package manager:
npm install -g multranslate
Run the application:
multranslate
Get help:
multranslate --help
Usage: multranslate [options]
Cross-platform TUI for translating text in multiple translators simultaneously and LLM via OpenAI, with support for
translation history and automatic language detection.
Options:
-V, --version output the version number
-l, --language <name> select language: ru, ja, zh, ko, ar, tr, uk, sk, pl, de, fr, it, es, el, hu, nl, sv, ro,
cs, da, pt, vi (default: "ru")
-t, --translator <name> select translator: all, Google, DeepL, Reverso, MyMemory, OpenAI (default: "all")
-k, --key <value> API key for using the OpenAI translator (will be saved for future use)
-h, --help display help for command
Clone the repository:
git clone https://github.com/Lifailon/multranslate
cd multranslate
Install dependencies and run the application:
npm install
npm start
You can change the language for automatic definition between English and any of those presented in the table below:
Parameter | Language |
---|---|
ru | Russian (default) |
ja | Japanese |
zh | Chinese |
ko | Korean |
ar | Arabic |
tr | Turkish |
uk | Ukrainian |
sk | Slovak |
pl | Polish |
de | German |
fr | French |
it | Italian |
es | Spanish |
el | Greek |
hu | Hungarian |
nl | Dutch |
sv | Swedish |
ro | Romanian |
cs | Czech |
da | Danish |
pt | Portuguese (#1) |
vi | Vietnam (#2) |
All passed letters are analyzed to compare them between the English alphabet and the language specified in the --language
parameter.
You can also use any of the translators individually by specifying the appropriate option at startup:
multranslate --translator Google --language tr
|
multranslate --translator DeepL --language de
|
multranslate --translator Reverso --language it
|
multranslate --translator MyMemory --language es
|
F2
- switch between all translators and OpenAI.Ctrl+<Enter/S>
- translation of text without breaking to a new line.Ctrl+V
- paste text from the clipboard (defined at the code level).Alt+C
- copy text from the input field to clipboard.Alt+<1/2/3/4/5>
- copying translation results from output window to the clipboard (for each translator, the key combination is indicated in brackets), and the selected form will change its color to green.Ctrl+<N/Z>
- move to the previous entry in the translation history.Ctrl+<P/X>
- move to the next entry in the translation history.Shift+<Up/Down>
- simultaneous scrolling of all output panels.Ctrl+<Up/Down>
- scrolling the text input panel without changing the cursor position.Ctrl+<Left/Right>
- quick cursor navigation through phrases.Ctrl+<A/E>
- move the cursor to the ahead or end of text input.Ctrl+<C/U/L>
- clear the text input field.Ctrl+W/Alt+Back
- delete the word before the cursor.Del/Ctrl+K
- deletes one letter or character after the cursor.Escape
- exit the program.
Use the F1
key to get help on available keyboard shortcuts:
If your language is not listed or you have problems with translation, please open an issue in the Issues.
You can also offer another source for translating the text through API
, which does not require an access key.
If you like to use this interface, you can make a contribution, just translate this readme file to your own language and pass it through Pull Request.
- Rewrite code to TypeScript.
- Implement native cursor support (developments in multranslate-native-cursor).
- Check texts for style and grammar (spelling) via LanguageTool.
The Blessed library is great and has no analogues in its functionality for JavaScript
or TypeScript
(and even surpasses some libraries in other languages), but it is outdated (not supported since 2015) and has a number of technical limitations, for example, there is no ability to navigate the cursor in the text input field. For this reason, a mechanism for managing the input content through a text buffer was implemented, which allows you to use a custom cursor for navigation using keyboard arrows and automatic scrolling.
If you plan to use this library for similar tasks where text input is required, then add class TextBuffer
and control of hotkeys (keypress
) via inputBox.on()
to your code. It took me several weeks to achieve full functionality for working with text, the key problem is the built-in line break (autowrap
) and the shift of the custom cursor.
Over the course of daily use for 6 months, I can confirm that it works stably.