From e8835e7ad1bc02cad6aa21b3ad76690847f9e5ce Mon Sep 17 00:00:00 2001 From: Charles Cabergs Date: Sun, 29 Sep 2024 18:55:51 +0200 Subject: Fix translate-prompt script --- local/bin/translate-prompt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/local/bin/translate-prompt b/local/bin/translate-prompt index 9419f2a..d1588da 100755 --- a/local/bin/translate-prompt +++ b/local/bin/translate-prompt @@ -1,5 +1,7 @@ #!/bin/sh +set -e + command -v trans > /dev/null || { echo "translate-shell not installed" ; exit 1 ; } command -v rofi > /dev/null && @@ -26,7 +28,7 @@ case "$choice" in "$TERMINAL" -e "$EDITOR" "$text_file" ;; *) - echo -n "$choice" > "$text_file" + printf '%s' "$choice" > "$text_file" ;; esac @@ -37,4 +39,9 @@ then sed -i '1 s/^#//' "$text_file" fi -"$TERMINAL" -e trans $brief -view -input "$text_file" +translation_file="$(mktemp /tmp/translate_prompt_translation_XXXXXX)" +trans $brief -input "$text_file" -output "$translation_file" +"$TERMINAL" -e less "$translation_file" + +# -view gives one line at a time? +# "$TERMINAL" -e trans $brief -view -input "$text_file" -- cgit