diff --git a/scripts/termux-speech-to-text.in b/scripts/termux-speech-to-text.in index 4bc7fd0..06d46b2 100644 --- a/scripts/termux-speech-to-text.in +++ b/scripts/termux-speech-to-text.in @@ -9,11 +9,12 @@ show_usage () { } show_progress=false -while getopts :hp option +while getopts :hpl: option do case "$option" in h) show_usage;; p) show_progress=true;; + l) language=${OPTARG};; ?) echo "$SCRIPTNAME: illegal option -$OPTARG"; exit 1; esac done @@ -22,8 +23,4 @@ shift $((OPTIND-1)) if [ $# != 0 ]; then echo "$SCRIPTNAME: too many arguments"; exit 1; fi CMD=@TERMUX_PREFIX@/libexec/termux-api -if [ $show_progress = true ]; then - $CMD SpeechToText -else - $CMD SpeechToText | tail -1 -fi +$CMD SpeechToText --es language ${language:-en-US} | if [ $show_progress = true ]; then cat; else tail -1; fi