<< All Posts
Creating a command line translator on Ubuntu


<pre>#!/bin/sh echo "en: $1" espeak -v en $1 echo "pt: " $1 | translate-bin -t pt -f en -s google | cut -d '>' -f2 </pre>

At first you have to install libtranslate-bin and espeak with the follow command:

sudo apt-get install libtranslate-bin espeak

and then you have to create e simple file that I decide to call ‘en’ with the commands bellow:

I created two files. ‘en’ and ‘pt’. One to translate from English and other to transLate from Brazilian Portuguese.

Before you use, you have to set the execution chmod for this file:

chmod +x en

After this, you can put this in your personal path.

cd ~ mkdir bin mv en bin

To reload your .profile and activate your path, you just type this:

. ~/.profile

Now you can test your script!

en 'the book is on the table'



<< All Posts

rodolfo.io

🇧🇷 🇨🇦
Runs on OpenBSD 🐡