translate(){
if [ $# = 0 ] || [ "$1" = "--help" ] || [ "$1" = "-h" ]; then
echo -e "Traduce texto con el Google Translator."
echo -e " Uso :"
echo -e " $(basename ${0}) idioma_de_origen idioma_de_destino texto "
echo -e " $(basename ${0}) -l para la lista de idiomas"
return
fi
if [ "$1" = "-l" ]; then
echo -e " afrikaans af
albanés sq francés fr persa fa
alemán de galés cy polaco pl
árabe ar gallego gl portugués pt
armenio hy georgiano ka rumano ro
azerí az griego el ruso ru
bieloruso be hebreo iw serbio sr
búlgaro bg hindi hi suajili sw
catalán ca holandés nl sueco sv
checo cs húngaro hu tagalo tl
chino zh indonesio id tailandés th
ch_trd zh-TW inglés en turco tr
coreano ko irlandés ga ucraniano uk
creole .H ht islandés is urdu ur
croata hr italiano it vietnamit vi
danés da japonés ja yiddish yi
eslovaco sk letón lv
esloveno sl lituano lt
español es macedonio mk
estonio et malayo ms
euskera eu maltés mt
finlandés fi noruego no"
return
fi
lang="$1"
lang2="$2"
shift
shift
text=$*
wget -U "Mozilla/5.0" -qO - "http://translate.google.com/translate_a/t?client=t&text=$text&sl=$lang&tl=$lang2" | sed 's/\[\[\[\"//' | cut -d \" -f 1 > /tmp/voz
texto=`cat /tmp/voz`
echo $texto
if [ "${lang2}" != "es" ]; then
mplayer -really-quiet "http://translate.google.com/translate_tts?tl=${lang2}&q=$texto" 2> null
fi
}
translate $*
No hay comentarios:
Publicar un comentario