From Apertium
Jump to navigation Jump to search

How to add an translate: handler in Firefox[edit]

You only need 3 steps:

  • Copy this script in your /usr/local/bin as
TMP=`mktemp -d`
pair=`echo $1 | cut -d : -f 2`
address=`echo $1 | cut -d : -f 3-`
echo pair:$pair addr:$address
cd $TMP
wget -k ${address} -O $TMP/index.html
apertium $pair -u -f html $TMP/index.html >$TMP/trindex.html
firefox $TMP/trindex.html
rm -Rf $TMP
  • Change the permos to that file
chmod +x /usr/local/bin/
  • Add the handler to the firefox. To do this enter in your address bar

It will ask you if you are sure. Accept.

Clic with your write button and add a "New->String"

Enter and the value /usr/local/bin/

And voilá! The first time you try it It will ask you for associate an application you will need to give it the correct path for again.

You could now test it, enter in your addres bar: