Console-Translate
0.3.5
See the version list below for details.
dotnet add package Console-Translate --version 0.3.5
NuGet\Install-Package Console-Translate -Version 0.3.5
<PackageReference Include="Console-Translate" Version="0.3.5" />
paket add Console-Translate --version 0.3.5
#r "nuget: Console-Translate, 0.3.5"
// Install Console-Translate as a Cake Addin #addin nuget:?package=Console-Translate&version=0.3.5 // Install Console-Translate as a Cake Tool #tool nuget:?package=Console-Translate&version=0.3.5
Console-Translate
⚠ This module is not planned to be supported. Try it cross-platform TUI for translating text using multiple providers simultaneously.
PowerShell module (cross-platform cli client) for free text translation using Google (public serverless on Vercel), DeepLX (public serverless on Vercel), MyMemory and Reverso providers via REST API
(no token required).
This module also automates the process of installing, updating, managing and working with the DeepLX server.
- 💡 About
- 🚀 Install module to Windows
- 🐧 Install module to Linux
- 🎉 Examples
- 🔨 DeepLX
- 📢 Module not using API
💡 About
The module can be very useful if you spend a lot of time in the console or do not want to use a browser or third-party applications to translate text.
The work of the module is automated and free of charge, no additional intervention in the work of the module is required from you.
The process of determining the language for the LanguageSource
and LanguageTarget
parameters is automated between Russian and English. This process can be automated for any language.
This module also automates the process of launching the DeepLX server for local or remote use on other machines (e.g. those without Internet access).
Tested on Windows 10/11 and Ubuntu Server 20.04+ using PowerShell Core version 7.2 +.
🚀 Install module to Windows
NuGet
Pre-register the repository, if you haven't already.
Register-PSRepository -Name "NuGet" -SourceLocation "https://www.nuget.org/api/v2" -InstallationPolicy Trusted
Install-Module Console-Translate -Repository NuGet
MyGet
Register-PSRepository -Name "lifailon" -SourceLocation "https://www.myget.org/F/lifailon/api/v2" -InstallationPolicy Trusted
Install-Module Console-Translate -Repository lifailon
Scoop
- Install the package manager:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser && irm https://get.scoop.sh | Invoke-Expression
- Install the module:
scoop bucket add Console-Translate https://github.com/Lifailon/Console-Translate.git
scoop install Console-Translate
- To remove module:
scoop uninstall Console-Translate && scoop Bucket rm Console-Translate
GitHub
Deployment a module from the GitHub repository with a single command in the console:
Invoke-Expression(New-Object Net.WebClient).DownloadString("https://raw.githubusercontent.com/Lifailon/Console-Translate/rsa/deploy-module.ps1")
- Import the module:
Import-Module Console-Translate
Get-Command -Module Console-Translate
CommandType Name Version Source
----------- ---- ------- ------
Function Get-Translate 0.3 Console-Translate
Function Install-DeepLX 0.3 Console-Translate
Function Start-DeepLX 0.3 Console-Translate
Function Stop-DeepLX 0.3 Console-Translate
Function Get-DeepLX 0.3 Console-Translate
🐧 Install module to Linux
💡 Dependence: PowerShell Core
- Example install PowerShell to Ubuntu:
sudo apt-get install -y wget apt-transport-https software-properties-common
curl -s https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb -o packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt-get update
sudo apt-get install -y powershell
- Install module:
pwsh -c 'Invoke-Expression(New-Object Net.WebClient).DownloadString("https://raw.githubusercontent.com/Lifailon/Console-Translate/rsa/deploy-module.ps1")'
Run the PowerShell interpreter using the pwsh
command. All commands for Windows are identical for execution in Linux on PowerShell Core (pwsh).
🎉 Examples
The parameters limit the use of this cmdlet to two languages: English (en
) and Russian (ru
), for which there is automatic detection of the source language at the PowerShell code level.
Get-Translate "Module for text translation" -Provider Google
Модуль для перевода текста
Get-Translate "Модуль для перевода текста"
Text translation module
Get-Translate "Hello друг" -LanguageSelected
Language Source: EN
Language Target: RU
Привет друг
Get-Translate "Привет world" -LanguageSelected
Language Source: RU
Language Target: EN
Hello world
Get-Translate "Module for text translation" -Provider DeepL
Модуль для перевода текста
Get-Translate "Module for text translation" -Provider MyMemory
Модуль для перевода текста
Текстовый перевод.
Перевод текста БД
Get-Translate "Module for text translation" -Provider Reverso
Модуль перевода текстов
🔨 DeepLX
Supported languages from the drop-down list (encoded in the parameter) with support for automatic language detection at the api level.
Abbr | EN (RU) |
---|---|
EN |
English (Английский) |
RU |
Russian (Русский) |
JA |
Japanese (Японский) |
ZH |
Chinese (Китайский) |
KO |
Korean (Корейский) |
TR |
Turkish (Турецкий) |
UK |
Ukrainian (Украинский) |
SK |
Slovak (Словацкий) |
SL |
Slovenian (Словенский) |
LT |
Lithuanian (Литовский) |
PL |
Polish (Польский) |
CS |
Czech (Чешский) |
FI |
Finnish (Финский) |
ET |
Estonian (Эстонский) |
BG |
Bulgarian (Болгарский) |
DA |
Danish (Датский) |
LV |
Latvian (Латышский) |
IT |
Italian (Итальянский) |
ES |
Spanish (Испанский) |
FR |
French (Французский) |
PT |
Portuguese (Португальский) |
RO |
Romanian (Румынский) |
SV |
Swedish (Шведский) |
HU |
Hungarian (Венгерский) |
EL |
Greek (Греческий) |
NB |
Norwegian Bokmal (Норвежский) |
NL |
Dutch (Нидерландский) |
DE |
German (Немецкий) |
ID |
Indonesian (Индонезийский) |
AR |
Arabic (Арабский) |
Local server
Install or update the DeepLX server executable for local or remote use with a single command (for Windows and Linux):
Install-DeepLX
When calling the module, if the remote server address is not specified (parameter: Server), the local server is started for the time of sending a request and receiving a response, after which the server stops, it allows not to keep resources and socket open.
# Russian to English
Get-DeepLX "Помоги перевести текст"
Help translate a text
Help translate the text
Help me translate a text
# English to Russian
Get-DeepLX "Help translate text" ru
Помочь перевести текст
Помощь в переводе текста
# English to Japanese
Get-DeepLX "Help translate text" ja
テキストの翻訳を手伝う
テキストを翻訳する
テキストの翻訳を支援
# Japanese to Russian
Get-DeepLX "テキストの翻訳を手伝う" ru
Помогите перевести тексты.
Помогите переводить тексты.
Помогите перевести текст.
# English to Chinese
Get-DeepLX "Help translate text" zh
帮助翻译文字
协助翻译文本
# English to Turkish
Get-DeepLX "Help translate text" tr
Metni çevirmeye yardımcı olun
Metin çevirisine yardım edin
Metni çevirmeye yardım et
Remote server
If you need to use a single server to handle all requests from multiple clients on the network, you can use this construct:
📭 Start the server:
Start-DeepLX -Job
Start-DeepLX -Status
Running
This will allow you to run the server in the backgroundю. The default port is 1188
and the api token (this key is used for authorization on the server) is 7777777777
.
✉️ Execute a requests to the remote server:
Get-DeepLX -Text "Перевод текста на удаленном сервере" -Server 192.168.3.100
Translation of text on a remote server
Translate a text on a remote server
Translating text on a remote server
Get-DeepLX -Text "Перевод текста на удаленном сервере" -Server 192.168.3.100 -Port 1188 -Token "7777777777"
Translation of text on a remote server
Translate a text on a remote server
Translating text on a remote server
✋ Server stop:
Stop-DeepLX
Start-DeepLX -Status
Not running
Windows Terminal
To speed up the process of interacting with the module, program hotkeys in Windows Terminal:
Open the JSON configuration file
in Application Settings and add or edit the Actions
block:
"actions":
[
{
"command":
{
"action": "copy",
"singleLine": false
},
"keys": "ctrl+c" // default: ctrl+shift+c
},
{
"command": "paste",
// We save the classic interpreter insertion via ctrl+v, without forcing you to execute the code line by line
"keys": "ctrl+shift+v" // default: ctrl+v
},
{
"command":
{
"action": "sendInput",
"input": "\u0001\u001b[3~Get-Translate -Provider Google ''\u001b[D"
},
"keys": "ctrl+g"
},
{
"command":
{
"action": "sendInput",
"input": "\u0001\u001b[3~Get-Translate -Provider Google -Text $(Get-Clipboard)\u001b[D\r"
},
"keys": "ctrl+shift+g"
}
]
The first two command blocks are responsible for redefining the copy and paste keys from the clipboard (use Ctrl+C
and Ctrl+V
as in the classic PowerShell terminal, getting rid of intrusive warnings about pasting text and line-by-line execution of commands).
The third parameter is responsible for processing the Ctrl+G
key press, which preliminarily clears the input line, after which it causes the text to be inserted: Get-Translate -Provider Google ''
and moves the cursor to the center of the quotation marks, which allows you to enter text and call translation immediately after pressing . The last command does the same thing, but pastes text from the clipboard (using the built-in Get-Clipboard
command) and calls execution to instantly translate the text when you press Ctrl+Shift+G
.
Similarly, you can assign the translation call for DeepL/DeepLX, MyMemory and Reverso to other key combinations.
📢 Module not using API
You can use a module that dont use an API, instead using Selenium via .NET to PowerShell for compose requests directly to the application:
Automated deployment and updating of all dependencies: Deploy Selenium: Deploy-Selenium
Repository: Selenium-Modules
Module: Get-Translate
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.