Skip to content

Commit 89c08f2

Browse files
committed
add clear history, trim for paste and alternatives for mymemory
1 parent 71643c2 commit 89c08f2

File tree

4 files changed

+17
-30
lines changed

4 files changed

+17
-30
lines changed

README.md

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,17 @@
1212
<strong>English</strong> | <a href="README_RU.md">Русский</a>
1313
</h4>
1414

15-
A terminal user interface (TUI) based on the [Blessed](https://github.com/chjj/blessed) library for simultaneous text translation using multiple translation sources. All sources do not require an access token or any customization. Supports **automatic source and target language detection** at the code level between English and Russian and access to **translation history** via [SQLite](https://github.com/WiseLibs/better-sqlite3).
15+
A terminal user interface (TUI) based on the [Blessed](https://github.com/chjj/blessed) library for simultaneous text translation using multiple translation sources. All sources do not require an access token or other settings. Supports **automatic source and target language detection** at the code level between English and Russian (default) and access to **translation history** via [SQLite](https://github.com/WiseLibs/better-sqlite3) (up to 500 queries, after which an automatic cleaning of old values from the history is applied).
1616

1717
![interface](/image/interface.jpg)
1818

1919
## 📚 Translation providers
2020

21-
- Google via free and unlimited [API](https://github.com/matheuss/google-translate-api) using [serverless](https://github.com/olavoparno/translate-serverless-vercel) hosted on Vercel.
22-
- [DeepLX](https://github.com/OwO-Network/DeepLX) - free [DeepL](https://deepl.com) API using [serverless](https://github.com/LegendLeo/deeplx-serverless) hosted on [Vercel](https://github.com/bropines/Deeplx-vercel).
23-
- [MyMemory](https://mymemory.translated.net/doc/spec.php) - free and open api (usage is limited to 5000 chars/day).
24-
- [Reverso](https://www.reverso.net) - free api (does not contain official documentation, request was received from official site through DevTools).
21+
- [Google](https://translate.google.com) - free and unlimited [API](https://github.com/vitalets/google-translate-api) using [serverless](https://github.com/olavoparno/translate-serverless-vercel) hosted on Vercel. Available for translation more than 5000 characters.
22+
- [DeepL](https://www.deepl.com) - free API via [DeepLX](https://github.com/OwO-Network/DeepLX) using [serverless](https://github.com/LegendLeo/deeplx-serverless) hosted on [Vercel](https://github.com/bropines/Deeplx-vercel). There are limitations on the number of frequent requests for translation, can have limitations when using a large number of - [Reverso](https://www.reverso.net) - the most stable, free and without any limitation on the number of characters (version on the site is limited to 2000 characters and 900 through the application, through the API can get up to 8000). Does not contain official documentation, request was received from official site via *DevTools*.characters (official limit of 5000 characters per request).
23+
- [MyMemory](https://mymemory.translated.net/doc/spec.php) - free and open API (limit of 500 characters per request). Supports up to 3 response options for short queries.
2524

26-
> **Reverso** does not support working via **Axios** (error: `Invalid header value char`), **Fetch** is used instead.
25+
> **Reverso** does not support working via **Axios** (error: `Invalid header value char`), **Fetch** is used instead. For this reason, the package cannot be packaged with the 'pkg' without errors during startup.
2726
2827
## 🚀 Installation
2928

@@ -54,26 +53,20 @@ Run the application:
5453
npm start
5554
```
5655

57-
To debug the interface:
58-
59-
```shell
60-
npm run dev
61-
```
62-
6356
## 💡 Text buffer
6457

65-
The Blessed library is deprecated (no longer supported) and has a number of technical limitations, such as cursor navigation in a text input field. For this reason, a mechanism for managing input text via text buffer has been implemented, which allows using a custom cursor for navigation using keyboard arrows and automatic scrolling for swiping.
58+
The Blessed library is outdated (no longer supported) and has a number of technical limitations, such as not being able to navigate the cursor in the input field. For this reason, a mechanism for managing input text via text buffer has been implemented, which allows using a custom cursor for navigation using keyboard arrows and automatic scrolling for swiping.
6659

6760
If you plan to use this library for similar tasks where text input is required, then add `class TextBuffer` and control of `keypress` shortcuts to your code via `inputBox.on()`.
6861

6962
## ⌨ Hotkeys
7063

7164
- `Enter` - is used each time to translate the text simultaneously with moving to a new line.
7265

73-
- `Ctrl+V` - paste text from the clipboard (defined at the code level).
74-
7566
- `Ctrl+<Q/W/E/R>` - copying translation results from output forms to the clipboard (for each translator, the key combination is indicated in brackets), and the selected form will change its color to green.
7667

68+
- `Ctrl+V` - paste text from the clipboard (defined at the code level).
69+
7770
- `Ctrl+Z`: Navigate through the history of translation requests from the end.
7871

7972
- `Ctrl+X`: Navigate through the translation history in reverse order.

README_RU.md

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,18 @@
1212
<a href="README.md">English</a> | <strong>Русский</strong>
1313
</h4>
1414

15-
Терминальный пользовательский интерфейс (TUI) на базе библиотеки [Blessed](https://github.com/chjj/blessed) для одновременного перевода текста с использованием нескольких источников перевода. Все источники не требуют токена доступа или каких-либо настроек. Поддерживает **автоматическое определение исходного и целевого языка** на уровне кода между английским и русским и доступ к **истории переводов** через [SQLite](https://github.com/WiseLibs/better-sqlite3).
15+
Терминальный пользовательский интерфейс (TUI) на базе библиотеки [Blessed](https://github.com/chjj/blessed) для одновременного перевода текста с использованием нескольких источников перевода. Все источники не требуют токена доступа или других настроек. Поддерживает **автоматическое определение исходного и целевого языка** на уровне кода между английским и русским (по умолчанию) и доступ к **истории переводов** через [SQLite](https://github.com/WiseLibs/better-sqlite3) (до 500 запросов, после чего применяется автоматическая чистка старых значений из истории).
1616

1717
![interface](/image/interface.jpg)
1818

1919
## 📚 Источники перевода
2020

21-
- Google через бесплатный и безлимитный [API](https://github.com/matheuss/google-translate-api) с использованием [serverless](https://github.com/olavoparno/translate-serverless-vercel), размещенный на Vercel.
22-
- [DeepLX](https://github.com/OwO-Network/DeepLX) - бесплатный [DeepL](https://deepl.com) API с использованием [serverless](https://github.com/LegendLeo/deeplx-serverless), размещенный на [Vercel](https://github.com/bropines/Deeplx-vercel).
23-
- [MyMemory](https://mymemory.translated.net/doc/spec.php) - бесплатный и открытый API (использование ограничено 5000 символами в день).
24-
- [Reverso](https://www.reverso.net) - бесплатный API (не содержит официальной документации, запрос был получен с официального сайта через *DevTools*).
21+
- [Google](https://translate.google.com) - бесплатный и безлимитный [API](https://github.com/vitalets/google-translate-api) с использованием [serverless](https://github.com/olavoparno/translate-serverless-vercel) размещенный на Vercel. Доступно для перевода более 5000 символов.
22+
- [DeepL](https://www.deepl.com) - бесплатный API через [DeepLX](https://github.com/OwO-Network/DeepLX) с использованием [serverless](https://github.com/LegendLeo/deeplx-serverless) размещенный на [Vercel](https://github.com/bropines/Deeplx-vercel). Присутствуют ограничения на частое количество запросов перевода, может иметь ограничения при использование большого количества символов (официальное ограничение в 5000 символов на запрос).
23+
- [Reverso](https://www.reverso.net) - самый стабильный, бесплатный и без ограничений на количество символов (версия на сайте ограничена 2000 символам и 900 через приложение, через `API` возможно получить до 8000). Не содержит официальной документации, запрос был получен с официального сайта через *DevTools*.
24+
- [MyMemory](https://mymemory.translated.net/doc/spec.php) - бесплатный и открытый API (ограничение в 500 символов на запрос). Поддверживает до 3 вариантов ответа для коротких запросов.
2525

26-
> **Reverso** не поддерживает работу через **Axios** (ошибка: `Invalid header value char`), вместо этого используется **Fetch**.
26+
> **Reverso** не поддерживает работу через **Axios** (ошибка: `Invalid header value char`), вместо этого используется **Fetch**. По этой причине не получается упаковать пакет с помощью `pkg` без ошибок при запуске.
2727
2828
## 🚀 Установка
2929

@@ -54,26 +54,20 @@ cd multranslate
5454
npm start
5555
```
5656

57-
Для отладки интерфейса:
58-
59-
```shell
60-
npm run dev
61-
```
62-
6357
## 💡 Текстовый буфер
6458

65-
Библиотека Blessed является устаревшей (более не поддерживается) и имеет ряд технических ограничений, например, навигация курсора в поле ввода текста. По этой причине был реализован механизм управления содержимым ввода через текстовый буфер, который позволяет использовать кастомный курсор для навигации с помощью стрелочек клавиатуры и автоматический скроллинг для пролистывания.
59+
Библиотека Blessed является устаревшей (более не поддерживается) и имеет ряд технических ограничений, например, отсутствует возможность навигации курсора в поле ввода текста. По этой причине был реализован механизм управления содержимым ввода через текстовый буфер, который позволяет использовать кастомный курсор для навигации с помощью стрелочек клавиатуры и автоматический скроллинг для пролистывания.
6660

6761
Если вы планируете использовать данную библиотеку для схожих задач где требуется ввод текста, то добавьте в свой код `class TextBuffer` и управление корячими клавишами `keypress` через `inputBox.on()`.
6862

6963
## ⌨ Горячие клавиши
7064

7165
- `Enter`: используется каждый раз для перевода текста одновременно с переносом на новую строку.
7266

73-
- `Ctrl+V`: вставка текста из буфера обмена (определено на уровне кода).
74-
7567
- `Ctrl+<Q/W/E/R>`: копирования результатов перевода из форм вывода в буфер обмена (для каждого переводчика комбинация клавиш указана в скобках), при этом выбранная форма изменит свой цвет на зеленый.
7668

69+
- `Ctrl+V`: вставка текста из буфера обмена (определено на уровне кода).
70+
7771
- `Ctrl+Z`: Навигация по истории запросов на переводы с конца.
7872

7973
- `Ctrl+X`: Навигация по истории переводов в обратном порядке.

image/hotkeys.jpg

16.9 KB
Loading

image/interface.jpg

155 KB
Loading

0 commit comments

Comments
 (0)