diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2024-09-29 18:55:51 +0200 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2024-09-29 18:55:51 +0200 |
| commit | e8835e7ad1bc02cad6aa21b3ad76690847f9e5ce (patch) | |
| tree | 69fe1bf9dfe843deb44a997bb2610583c93b4bb1 /local/bin | |
| parent | 11f9d42aa0dadc15978172207655e436b518f4fe (diff) | |
| download | dotfiles-e8835e7ad1bc02cad6aa21b3ad76690847f9e5ce.tar.gz dotfiles-e8835e7ad1bc02cad6aa21b3ad76690847f9e5ce.tar.bz2 dotfiles-e8835e7ad1bc02cad6aa21b3ad76690847f9e5ce.zip | |
Fix translate-prompt script
Diffstat (limited to 'local/bin')
| -rwxr-xr-x | local/bin/translate-prompt | 11 |
1 files 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" |
