PowerShell module for translating text directly in the console PowerShell.
- 💡 About
- 🚀 Install module to Windows
- 🐧 Install module to Linux
- 🎉 Examples
- 📑 Getting language codes
- 📢 Module not using API
The module can be very useful if you spend a lot of time in the console or don't want to keep a third-party application open.
Used providers:
- Google (public API key added to the default parameter);
- MyMemory (API key not required);
- DeepL (required API token) and DeepLX (free API, no token required)
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 language definition for the LanguageSource and LanguageTarget parameters is automated between Russian and English. This process can be automated for all languages.
Tested on Windows 10, Ubuntu Server 20.04 and 22.04 using PowerShell Core version 7.2 +.
Use the NuGet package manager:
Install-Module Console-Translate -Repository NuGet
💡 You must have a NuGet repository registered:
Register-PSRepository -Name "NuGet" -SourceLocation "https://www.nuget.org/api/v2" -InstallationPolicy Trusted
Or install a module from the GitHub repository (including dependencies, DeepLX binary) with a single command in the console:
Invoke-Expression(New-Object Net.WebClient).DownloadString("https://github.com/raw/Lifailon/Console-Translate/rsa/Deploy-Console-Translate.ps1")
Import the module:
> Import-Module Console-Translate
> Get-Command -Module Console-Translate
CommandType Name Version Source
----------- ---- ------- ------
Function Get-DeepLX 0.2 Console-Translate
Function Get-LanguageCode 0.2 Console-Translate
Function Get-Translate 0.2 Console-Translate
Function Start-DeepLX 0.2 Console-Translate
Function Stop-DeepLX 0.2 Console-Translate
Dependence: PowerShell Core
Example install 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://github.com/raw/Lifailon/Console-Translate/rsa/Deploy-Console-Translate.ps1")'
Enter in to the PowerShell Core interpreter (pwsh) and import the module:
root@hv-devops-01:/home/lifailon# pwsh
PowerShell 7.4.1
PS /home/lifailon> Import-Module Console-Translate
All commands for Windows are identical for execution in Linux on PowerShell Core (pwsh).
You can see in the right corner how long each translation request takes (this does not depend on the amount of text being transferred).
To translate using Google Translate, a public API key has been added to the module (default for the parameter: -Key). To use your DeepL key, you must register on the provider website, create free token and specify it in the parameter: -Key.
> Get-Translate "Module for text translation"
Модуль для перевода текста
> Get-Translate "Модуль для перевода текста"
Text translation module
> Get-Translate "Привет world" -LanguageSelected
Language Source: RU
Language Target: EN
Hello world
> Get-Translate "Hello друг" -LanguageSelected
Language Source: EN
Language Target: RU
Привет друг
> Get-Translate -Text "Модуль для перевода текста" -LanguageSource ru -LanguageTarget tr # Russian -> Turkish
Metin çeviri modülü
> Get-Translate -Provider MyMemory -Text "MyMemory is the world's largest Translation Memory. It has been created collecting TMs from the European Union and United Nations, and aligning the best domain-specific multilingual websites."
MyMemory - крупнейшая в мире память переводов. Он был создан для сбора ТМ из Европейского Союза и Организации Объединенных Наций и согласования лучших многоязычных веб-сайтов, ориентированных на конкретные области.
> Get-Translate -Provider MyMemory -Text "Hello World" -Alternatives
Здравствуйте
Привет мир!
Всем привет!
Project source: DeepLX
The following cmdlets are used to start and access the DeepLX server:
Start-DeepLX
Stop-DeepLX
Get-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.
> Get-DeepLX "Get select" de
Auswahl treffen
> Get-DeepLX "Get select" ru
Получить выбор
> Get-DeepLX "Получить выбор" en
Get Choice
> Get-DeepLX "Получить выбор" en -Alternatives
Get a choice
Get the choice
Get your choice
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
✉️ Execute a requests to the remote server:
> Get-DeepLX -Server 192.168.3.99 -Text "Module for text translation" ru
Модуль для перевода текста
Server stop:
> Stop-DeepLX
> Start-DeepLX -Status
Not running
Getting language codes standart ISO-639-1:
> Get-LanguageCode
Country Code
------- ----
Abkhaz ab
Afar aa
Afrikaans af
Akan ak
Albanian sq
Amharic am
Arabic ar
Aragonese an
Armenian hy
Assamese as
Avaric av
Avestan ae
Aymara ay
Azerbaijani az
Bambara bm
Bashkir ba
Basque eu
Belarusian be
Bengali, Bangla bn
Bihari bh
Bislama bi
Bosnian bs
Breton br
Bulgarian bg
Burmese my
Catalan ca
Chamorro ch
Chechen ce
Chichewa, Chewa, Nyanja ny
Chinese zh
Chuvash cv
Cornish kw
Corsican co
Cree cr
Croatian hr
Czech cs
Danish da
Divehi, Dhivehi, Maldivian dv
Dutch nl
Dzongkha dz
Eastern Punjabi, Eastern Panjabi pa
English en
Esperanto eo
Estonian et
Ewe ee
Faroese fo
Fijian fj
Finnish fi
French fr
Fula, Fulah, Pulaar, Pular ff
Galician gl
Ganda lg
Georgian ka
German de
Greek el
Guarani gn
Gujarati gu
Haitian, Haitian Creole ht
Hausa ha
Hebrew he
Herero hz
Hindi hi
Hiri Motu ho
Hungarian hu
Icelandic is
Ido io
Igbo ig
Indonesian id
Interlingua ia
Interlingue ie
Inuktitut iu
Inupiaq ik
Irish ga
Italian it
Japanese ja
Javanese jv
Kalaallisut, Greenlandic kl
Kannada kn
Kanuri kr
Kashmiri ks
Kazakh kk
Khmer km
Kikuyu, Gikuyu ki
Kinyarwanda rw
Kirundi rn
Komi kv
Kongo kg
Korean ko
Kurdish ku
Kwanyama, Kuanyama kj
Kyrgyz ky
Lao lo
Latin la
Latvian lv
Limburgish, Limburgan, Limburger li
Lingala ln
Lithuanian lt
Luba-Katanga lu
Luxembourgish, Letzeburgesch lb
Macedonian mk
Malagasy mg
Malay ms
Malayalam ml
Maltese mt
Manx gv
Marathi mr
Marshallese mh
Mongolian mn
Maori mi
Nauruan na
Navajo, Navaho nv
Ndonga ng
Nepali ne
Northern Ndebele nd
Northern Sami se
Norwegian no
Norwegian Bokmal nb
Norwegian Nynorsk nn
Nuosu ii
Occitan oc
Ojibwe, Ojibwa oj
Old Church Slavonic, Church Slavonic, Old Bulgarian cu
Oriya or
Oromo om
Ossetian, Ossetic os
Pashto, Pushto ps
Persian fa
Polish pl
Portuguese pt
Pali pi
Quechua qu
Romanian ro
Romansh rm
Russian ru
Samoan sm
Sango sg
Sanskrit sa
Sardinian sc
Scottish Gaelic, Gaelic gd
Serbian sr
Shona sn
Sindhi sd
Sinhalese, Sinhala si
Slovak sk
Slovene sl
Somali so
Southern Ndebele nr
Southern Sotho st
Spanish es
Sundanese su
Swahili sw
Swati ss
Swedish sv
Tagalog tl
Tahitian ty
Tajik tg
Tamil ta
Tatar tt
Telugu te
Thai th
Tibetan Standard, Tibetan, Central bo
Tigrinya ti
Tonga to
Tsonga ts
Tswana tn
Turkish tr
Turkmen tk
Twi tw
Ukrainian uk
Urdu ur
Uyghur ug
Uzbek uz
Venda ve
Vietnamese vi
Volapuk vo
Walloon wa
Welsh cy
Western Frisian fy
Western Frisian wo
Xhosa xh
Yiddish yi
Yoruba yo
Zhuang, Chuang za
Zulu zu
You can use a module that dont use an API, instead using Selenium to compose requests directly to the application:
Repository: Selenium-Modules
Module: Get-Translate