multranslate
Advanced tools
Comparing version 0.4.1 to 0.4.2
@@ -110,3 +110,3 @@ #!/usr/bin/env node | ||
width: '49.5%', | ||
height: '40%', | ||
height: '39%', | ||
scrollable: true, | ||
@@ -138,3 +138,3 @@ alwaysScroll: true, | ||
width: '50%', | ||
height: '40%', | ||
height: '39%', | ||
scrollable: true, | ||
@@ -160,4 +160,19 @@ alwaysScroll: true, | ||
let infoContent = ` Ctrl+S: Get help on Hotkeys.` | ||
// Информация по навигации внизу формы | ||
const infoBox = blessed.text({ | ||
content: infoContent, | ||
bottom: 0, | ||
left: 0, | ||
right: 0, | ||
align: 'center', | ||
style: { | ||
fg: 'blue', | ||
bg: 'black' | ||
} | ||
}) | ||
// Информация по горячим клавишам | ||
const helpBox = blessed.box({ | ||
const hotkeysBox = blessed.box({ | ||
hidden: true, // Скрыть форму | ||
@@ -181,3 +196,3 @@ tags: true, // включить поддержку тегов для разметки | ||
helpBox.setContent(` | ||
hotkeysBox.setContent(` | ||
{yellow-fg}Hotkeys{/yellow-fg}: | ||
@@ -191,7 +206,7 @@ | ||
{blue-fg}Shift+<⬆/⬇>{/blue-fg}: Scrolling of all output panels | ||
{blue-fg}Ctrl+C{/blue-fg}: Clear text input field | ||
{blue-fg}Ctrl+<⬆/⬇>{/blue-fg}: Scrolling the text input panel without navigation | ||
{blue-fg}Ctrl+<⬅/➡\\>{/blue-fg}: Fast cursor navigation through words | ||
{blue-fg}Ctrl+<⬅/➡>{/blue-fg}: Fast cursor navigation through words | ||
{blue-fg}Ctrl+<A/D>{/blue-fg}: Move the cursor to the beginning or end of the input | ||
{blue-fg}Ctrl+Del{/blue-fg}: Remove word before cursor | ||
{blue-fg}Ctrl+<A/D>{/blue-fg}: Move the cursor to the beginning or end of the input | ||
{blue-fg}Ctrl+C{/blue-fg}: Clear text input field | ||
{red-fg}Escape{/red-fg}: Exit the program | ||
@@ -203,6 +218,6 @@ | ||
screen.key(['C-s'], function() { | ||
if (helpBox.hidden === true){ | ||
helpBox.show() | ||
if (hotkeysBox.hidden === true){ | ||
hotkeysBox.show() | ||
} else { | ||
helpBox.hide() | ||
hotkeysBox.hide() | ||
} | ||
@@ -217,3 +232,4 @@ }) | ||
screen.append(outputBox4) | ||
screen.append(helpBox) | ||
screen.append(infoBox) | ||
screen.append(hotkeysBox) | ||
@@ -273,3 +289,3 @@ // screen.append(textInfo) | ||
const db = new Database('./translation-history.db') | ||
const query = 'SELECT inputText FROM translationTable WHERE id = ?' | ||
const query = 'SELECT inputText,created_at FROM translationTable WHERE id = ?' | ||
const get = db.prepare(query) | ||
@@ -299,2 +315,8 @@ const data = get.get(id) | ||
function parseData(inputDate) { | ||
const [datePart, timePart] = inputDate.split(' ') | ||
const [year, month, day] = datePart.split('-') | ||
return `${timePart} ${day}.${month}.${year}` | ||
} | ||
// ------------------------------------- TextBuffer ------------------------------------- | ||
@@ -609,3 +631,4 @@ | ||
let currentLines = Math.ceil(line.length / maxChars) | ||
for (let i = 0; i < currentLines; i++) { | ||
const indices = [...Array(currentLines).keys()] | ||
for (let i of indices) { | ||
let start = i * maxChars | ||
@@ -616,3 +639,4 @@ let end = start + maxChars | ||
} | ||
} else { | ||
} | ||
else { | ||
textString.push(line) | ||
@@ -764,2 +788,3 @@ } | ||
const newText = lastText.inputText.replace(/\n/g, '\r') | ||
infoBox.content = `${infoContent} History: ${curID}/${maxID} (${parseData(lastText.created_at)})` | ||
buffer.setText(newText) | ||
@@ -789,2 +814,3 @@ buffer.setCursorPosition(newText.length) | ||
const newText = lastText.inputText.replace(/\n/g, '\r') | ||
infoBox.content = `${infoContent} History: ${curID}/${maxID} (${parseData(lastText.created_at)})` | ||
buffer.setText(newText) | ||
@@ -791,0 +817,0 @@ buffer.setCursorPosition(newText.length) |
{ | ||
"name": "multranslate", | ||
"version": "0.4.1", | ||
"description": "Cross-platform TUI for translating text using multiple providers simultaneously and support automatic detection of the source and destination language", | ||
"version": "0.4.2", | ||
"description": "Cross-platform TUI for translating text in multiple translators simultaneously, with support for translation history and automatic language detection.", | ||
"keywords": [ | ||
@@ -15,3 +15,5 @@ "TUI", | ||
"Cursor", | ||
"Custom-Cursor" | ||
"Custom-Cursor", | ||
"SQLite", | ||
"Better-SQLite3" | ||
], | ||
@@ -34,5 +36,3 @@ "author": "Lifailon", | ||
"blessed": "^0.1.81", | ||
"clipboardy": "^4.0.0", | ||
"sqlite": "^5.1.1", | ||
"sqlite3": "^5.1.7" | ||
"clipboardy": "^4.0.0" | ||
}, | ||
@@ -39,0 +39,0 @@ "bin": { |
@@ -15,5 +15,5 @@ <h1 align="center"> | ||
Терминальный пользовательский интерфейс на базе библиотеки [Blessed](https://github.com/chjj/blessed) для одновременного перевода текста с использованием нескольких источников перевода. Все источники не требуют токена доступа или каких-либо настроек. Поддерживает **автоматическое определение исходного и целевого языка** между английским и русским на уровне кода. | ||
Терминальный пользовательский интерфейс (TUI) на базе библиотеки [Blessed](https://github.com/chjj/blessed) для одновременного перевода текста с использованием нескольких источников перевода. Все источники не требуют токена доступа или каких-либо настроек. Поддерживает **автоматическое определение исходного и целевого языка** на уровне кода между английским и русским и доступ к **истории переводов** через [SQLite](https://github.com/WiseLibs/better-sqlite3). | ||
![Example](/example.jpg) | ||
![interface](/image/interface.jpg) | ||
@@ -72,20 +72,28 @@ ## 📚 Источники перевода | ||
- `Enter` - используется каждый раз для перевода текста одновременно с переносом на новую строку. | ||
- `Enter`: используется каждый раз для перевода текста одновременно с переносом на новую строку. | ||
- `Shift+<⬆/⬇>` - одновременный скроллинг всех панелей вывода. | ||
- `Ctrl+V`: вставка текста из буфера обмена (определено на уровне кода). | ||
- `Ctrl+<Q/W/E/R>` - копирования результатов перевода из форм вывода в буфер обмена (для каждого переводчика комбинация клавиш указана в скобках), при этом выбранная форма изменит свой цвет на зеленый. | ||
- `Ctrl+<Q/W/E/R>`: копирования результатов перевода из форм вывода в буфер обмена (для каждого переводчика комбинация клавиш указана в скобках), при этом выбранная форма изменит свой цвет на зеленый. | ||
- `Ctrl+V` - вставка текста из буфера обмена (определено на уровне кода). | ||
- `Ctrl+Z`: Навигация по истории запросов на переводы с конца. | ||
- `Ctrl+C` - очистить поле ввода текста. | ||
- `Ctrl+X`: Навигация по истории переводов в обратном порядке. | ||
- `Ctrl+<⬆/⬇>` - скроллинг панели ввода текста без навигации. | ||
- `Shift+<⬆/⬇>`: одновременный скроллинг всех панелей вывода. | ||
- `Ctrl+<⬅/➡>` - быстрая навигация курсора через словосочетания. | ||
- `Ctrl+<⬆/⬇>`: скроллинг панели ввода текста без навигации. | ||
- `Ctrl+DEL` - удалить словосочетание перед курсором. | ||
- `Ctrl+<⬅/➡>`: быстрая навигация курсора через словосочетания. | ||
- `Ctrl+<A/D>` - перевести курсор к началу или концу ввода текста. | ||
- `Ctrl+<A/D>`: перевести курсор к началу или концу ввода текста. | ||
- `Escape` - выход из программы. | ||
- `Ctrl+Del`: удалить словосочетание перед курсором. | ||
- `Ctrl+C`: очистить поле ввода текста. | ||
- `Escape`: выход из программы. | ||
Что бы получить справку по горячим клавишам, используйте комбинацию клавиш: `Ctrl+S` | ||
![interface](/image/hotkeys.jpg) |
@@ -15,5 +15,5 @@ <h1 align="center"> | ||
Terminal user interface 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 settings. Supports **automatic detection of source and target languages** between English and Russian at the code level. | ||
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). | ||
![Example](/example.jpg) | ||
![interface](/image/interface.jpg) | ||
@@ -74,10 +74,12 @@ ## 📚 Translation providers | ||
- `Shift+<⬆/⬇>` - simultaneous scrolling of all output panels. | ||
- `Ctrl+V` - paste text from the clipboard (defined at the code level). | ||
- `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. | ||
- `Ctrl+V` - paste text from the clipboard (defined at the code level). | ||
- `Ctrl+Z`: Navigate through the history of translation requests from the end. | ||
- `Ctrl+C` - clear the text input field. | ||
- `Ctrl+X`: Navigate through the translation history in reverse order. | ||
- `Shift+<⬆/⬇>` - simultaneous scrolling of all output panels. | ||
- `Ctrl+<⬆/⬇>` - scrolling the text input panel without navigation. | ||
@@ -87,6 +89,12 @@ | ||
- `Ctrl+DEL` - delete the phrase before the cursor. | ||
- `Ctrl+<A/D>` - move the cursor to the beginning or end of text input. | ||
- `Ctrl+Del` - delete the phrase before the cursor. | ||
- `Ctrl+C` - clear the text input field. | ||
- `Escape` - exit the program. | ||
To get hotkey help, use the keyboard shortcut: `Ctrl+S` | ||
![interface](/image/hotkeys.jpg) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1141874
4
8
1658
98
- Removedsqlite@^5.1.1
- Removedsqlite3@^5.1.7
- Removed@gar/promisify@1.1.3(transitive)
- Removed@npmcli/fs@1.1.1(transitive)
- Removed@npmcli/move-file@1.1.2(transitive)
- Removed@tootallnate/once@1.1.2(transitive)
- Removedabbrev@1.1.1(transitive)
- Removedagent-base@6.0.2(transitive)
- Removedagentkeepalive@4.5.0(transitive)
- Removedaggregate-error@3.1.0(transitive)
- Removedansi-regex@5.0.1(transitive)
- Removedaproba@2.0.0(transitive)
- Removedare-we-there-yet@3.0.1(transitive)
- Removedbalanced-match@1.0.2(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedcacache@15.3.0(transitive)
- Removedchownr@2.0.0(transitive)
- Removedclean-stack@2.2.0(transitive)
- Removedcolor-support@1.1.3(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removedconsole-control-strings@1.1.0(transitive)
- Removeddebug@4.3.7(transitive)
- Removeddelegates@1.0.0(transitive)
- Removedemoji-regex@8.0.0(transitive)
- Removedencoding@0.1.13(transitive)
- Removedenv-paths@2.2.1(transitive)
- Removederr-code@2.0.3(transitive)
- Removedfs-minipass@2.1.0(transitive)
- Removedfs.realpath@1.0.0(transitive)
- Removedgauge@4.0.4(transitive)
- Removedglob@7.2.3(transitive)
- Removedgraceful-fs@4.2.11(transitive)
- Removedhas-unicode@2.0.1(transitive)
- Removedhttp-cache-semantics@4.1.1(transitive)
- Removedhttp-proxy-agent@4.0.1(transitive)
- Removedhttps-proxy-agent@5.0.1(transitive)
- Removedhumanize-ms@1.2.1(transitive)
- Removediconv-lite@0.6.3(transitive)
- Removedimurmurhash@0.1.4(transitive)
- Removedindent-string@4.0.0(transitive)
- Removedinfer-owner@1.0.4(transitive)
- Removedinflight@1.0.6(transitive)
- Removedip-address@9.0.5(transitive)
- Removedis-fullwidth-code-point@3.0.0(transitive)
- Removedis-lambda@1.0.1(transitive)
- Removedjsbn@1.1.0(transitive)
- Removedlru-cache@6.0.0(transitive)
- Removedmake-fetch-happen@9.1.0(transitive)
- Removedminimatch@3.1.2(transitive)
- Removedminipass@3.3.65.0.0(transitive)
- Removedminipass-collect@1.0.2(transitive)
- Removedminipass-fetch@1.4.1(transitive)
- Removedminipass-flush@1.0.5(transitive)
- Removedminipass-pipeline@1.2.4(transitive)
- Removedminipass-sized@1.0.3(transitive)
- Removedminizlib@2.1.2(transitive)
- Removedmkdirp@1.0.4(transitive)
- Removedms@2.1.3(transitive)
- Removednegotiator@0.6.4(transitive)
- Removednode-addon-api@7.1.1(transitive)
- Removednode-gyp@8.4.1(transitive)
- Removednopt@5.0.0(transitive)
- Removednpmlog@6.0.2(transitive)
- Removedp-map@4.0.0(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedpromise-inflight@1.0.1(transitive)
- Removedpromise-retry@2.0.1(transitive)
- Removedretry@0.12.0(transitive)
- Removedrimraf@3.0.2(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedset-blocking@2.0.0(transitive)
- Removedsignal-exit@3.0.7(transitive)
- Removedsmart-buffer@4.2.0(transitive)
- Removedsocks@2.8.3(transitive)
- Removedsocks-proxy-agent@6.2.1(transitive)
- Removedsprintf-js@1.1.3(transitive)
- Removedsqlite@5.1.1(transitive)
- Removedsqlite3@5.1.7(transitive)
- Removedssri@8.0.1(transitive)
- Removedstring-width@4.2.3(transitive)
- Removedstrip-ansi@6.0.1(transitive)
- Removedtar@6.2.1(transitive)
- Removedunique-filename@1.1.1(transitive)
- Removedunique-slug@2.0.2(transitive)
- Removedwide-align@1.1.5(transitive)
- Removedyallist@4.0.0(transitive)