Added some slight error handling
This commit is contained in:
parent
0b0cfefecb
commit
43f658ccc5
|
@ -1,3 +1,10 @@
|
|||
stranslate (1.1) stable; urgency=medium
|
||||
|
||||
* Added some small semi error handling. Will flesh out
|
||||
more fully later on.
|
||||
|
||||
-- rail5 <andrew@rail5.org> Mon, 25 Sep 2023 12:53:51 +0800
|
||||
|
||||
stranslate (1.0) bullseye; urgency=low
|
||||
|
||||
* Added Debian packaging to the stranslate script
|
||||
|
|
|
@ -3,7 +3,12 @@
|
|||
CACHE_DIR="$HOME/.cache/stranslate/"
|
||||
|
||||
get_translation() {
|
||||
curl -s -F "from=${from_language}" -F "to=${to_language}" -F "text=${input}" https://simplytranslate.org/"${engine}" | grep -Poe "readonly>.*</textarea>" | sed -e "s/readonly>//g" | sed -e "s/<\/textarea>//g"
|
||||
translation=$(curl -s -F "from=${from_language}" -F "to=${to_language}" -F "text=${input}" https://simplytranslate.org/"${engine}" | grep -Poe "readonly>.*</textarea>" | sed -e "s/readonly>//g" | sed -e "s/<\/textarea>//g")
|
||||
if [ "$translation" = "" ]; then
|
||||
echo "stranslate: Error getting translation"
|
||||
else
|
||||
echo "$translation"
|
||||
fi
|
||||
}
|
||||
|
||||
get_languages() {
|
||||
|
|
Loading…
Reference in New Issue