Before using this package, make sure you have translate-shell installed on your system. If you don't, you can install it for your OS here. Make sure to install and use WSL when using Windows.
Once you have it installed, you can install this package using the following command:
espanso install quick-translate
espanso restart
After Installing, you can change the
sourcelang
and
targetlang
variables in defaultlang.yml to your desired default languages. You can find the valid names at the bottom of package.yml. Please note that if there's an update in the future, those files could be overwritten.
Usage
::trans
: Translates the selected text to the target language (default: English)
::etrans
: Extended Translate - Translates the Text from a source language (default: German) to a target language (default: English)
package.yml
defaultlang.yml
matches:-trigger:"::trans"label:"Translate"replace:"{{output}}"vars:-name:"input"type:formparams:layout:|
Text:
[[text]]
Target:
[[target]]
fields:target:type:choicedefault:"{{targetlang}}"values:"{{lang}}"text:multiline:true-name:"output"type:shellparams:cmd:"trans -b -t '{{input.target}}' '{{input.text}}'"shell:wsl-trigger:"::etrans"label:"Extended Translate"replace:"{{output}}"vars:-name:"input"type:formparams:layout:|
Text:
[[text]]
Source:
[[source]]
Target:
[[target]]
fields:source:type:choicedefault:"{{sourcelang}}"values:"{{lang}}"target:type:choicedefault:"{{targetlang}}"values:"{{lang}}"text:multiline:true-name:"output"type:shellparams:cmd:"trans -b -s '{{input.source}}' -t '{{input.target}}' '{{input.text}}'"shell:wslglobal_vars:-name:langtype:echoparams:echo:|
Afrikaans
Albanian
Amharic
Arabic
Armenian
Assamese
Aymara
Azerbaijani
Bambara
Bashkir
Basque
Belarusian
Bengali
Bhojpuri
Bosnian
Breton
Bulgarian
Cantonese
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Literary)
Chinese (Simplified)
Chinese (Traditional)
Chuvash
Corsican
Croatian
Czech
DanishShow more
# Default Variables for the source and target languageglobal_vars:-name:sourcelangtype:echoparams:echo:German-name:targetlangtype:echoparams:echo:English