Closed sy6sy2 closed 3 years ago
Which OS? Under macOS 10.14.6 it looks like this:
$ ./deepl.sh Bonjour.
{
"items": [
{
"uid": null,
"arg": "Bonjour",
"valid": "yes",
"autocomplete": "autocomplete",
"title": "Bonjour"
},
{
"uid": null,
"arg": "bonjour",
"valid": "yes",
"autocomplete": "autocomplete",
"title": "bonjour"
}
]
}
macOS 10.15.7
$ ./deepl.sh Bonjour.
$
No output on stdout and stderr but return code is 0.
Same issue on MacOs 11.0.1
[21:15:12.237] Logging Started...
[21:15:19.195] Deepl-Translate[Script Filter] Queuing argument 'smoke'
[21:15:19.276] Deepl-Translate[Script Filter] Script with argv '(null)' finished
[21:15:19.280] ERROR: Deepl-Translate[Script Filter] Code 1: {"items": [{"uid": null,"arg": "End query with a dot","valid": "yes","autocomplete": "autocomplete","title": "End query with a dot"}]}
[21:15:24.895] Deepl-Translate[Script Filter] Queuing argument 'smoke.'
[21:15:27.699] Deepl-Translate[Script Filter] Script with argv '(null)' finished
[21:15:41.087] Deepl-Translate[Script Filter] Queuing argument 'smoke '
[21:15:41.102] Deepl-Translate[Script Filter] Script with argv '(null)' finished
[21:15:41.109] ERROR: Deepl-Translate[Script Filter] Code 1: {"items": [{"uid": null,"arg": "End query with a dot","valid": "yes","autocomplete": "autocomplete","title": "End query with a dot"}]}
[21:15:43.216] Deepl-Translate[Script Filter] Queuing argument 'smoke wall'
[21:15:43.297] Deepl-Translate[Script Filter] Script with argv '(null)' finished
[21:15:43.301] ERROR: Deepl-Translate[Script Filter] Code 1: {"items": [{"uid": null,"arg": "End query with a dot","valid": "yes","autocomplete": "autocomplete","title": "End query with a dot"}]}
[21:15:45.277] Deepl-Translate[Script Filter] Queuing argument 'smoke wall.'
[21:15:46.889] Deepl-Translate[Script Filter] Script with argv '(null)' finished
Just tested on a rather clean macOS 11 installation and it works out of the box. So I'd need some more information to identify the underlying issue...
@AlexanderWillner Thanks for jumping in. I'm on 11.0.1 and just delete and imported the workflow to Alfred again. It sadly doesn't work.
$ ./deepl.sh Bonjour.
No output on stdout and stderr and return code is 0.
If you tell me what information you'd need I really would like to help.
Mh, you could write set -o xtrace
in the second line of the script, execute it and show the output. This might help...
@AlexanderWillner Here you go.
Thanks! Was same as #12 - just didn't create a new release. Should be fixed now. Thanks for the feedback.
Hi! Thank you but even with the latest release (tagged 1.19 but 1.18 on Alfred) I still have the issue.
Mh, interesting. Can you do what @avodaqstephan did so I can check?
Strange, it works well from the script but not from Alfred...
$ ./deepl.sh -l "FR" "Hello, how are you?".
+ PATH='/Users/sylvain/Thèse/Code/boa-v2/bin:/Users/sylvain/.opam/4.04.2/bin:/usr/local/opt/make/libexec/gnubin:/usr/local/opt/grep/libexec/gnubin:/usr/local/opt/gnu-sed/libexec/gnubin:/usr/local/opt/gnu-tar/libexec/gnubin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/Library/TeX/texbin:/usr/local/MacGPG2/bin:/opt/X11/bin:/Library/Apple/usr/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/usr/local/bin/'
+++ dirname ./deepl.sh
++ cd .
++ pwd
+ DIR=/Users/sylvain/Downloads/deepl-alfred-workflow2-1.19
+ LANGUAGE=EN
+ PARSER=jq
+ type jq
+ PARSER=/Users/sylvain/Downloads/deepl-alfred-workflow2-1.19/jq-dist
+ POSITIONAL=()
+ [[ 3 -gt 0 ]]
+ key=-l
+ case "$key" in
+ LANGUAGE=FR
+ shift
+ shift
+ [[ 1 -gt 0 ]]
+ key='Hello, how are you?.'
+ case "$key" in
+ POSITIONAL+=("$1")
+ shift
+ [[ 0 -gt 0 ]]
+ set -- 'Hello, how are you?.'
+ '[' -z 'Hello, how are you?.' ']'
++ echo 'Hello, how are you?.'
++ iconv -f utf-8-mac -t utf-8
++ tr -d '[:space:]'
+ query='Hello,howareyou?.'
+ [[ Hello,howareyou?. != *. ]]
++ echo 'Hello,howareyou?.'
++ sed 's/.$//'
+ query='Hello,howareyou?'
++ echo 'Hello,howareyou?'
++ sed 's/\"/\\\"/g'
+ query='Hello,howareyou?'
++ echo 'Hello,howareyou?'
++ sed 's/'\''/\\'\''/g'
+ query='Hello,howareyou?'
+ data='{"jsonrpc":"2.0","method": "LMT_handle_jobs","params":{"jobs":[{"kind":"default","raw_en_sentence":"Hello,howareyou?","preferred_num_beams":4,"raw_en_context_before":[],"raw_en_context_after":[],"quality":"fast"}],"lang":{"user_preferred_langs":["EN","DE"],"source_lang_user_selected":"auto","target_lang":"FR"},"priority":1,"timestamp":1557063997314},"id":79120002,"commonJobParams":{"formality":null}}'
+ HEADER=(--compressed -H 'Origin: https://www.deepl.com' -H 'Referer: https://www.deepl.com/translator' -H 'Accept: */*' -H 'Content-Type: application/json' -H 'Accept-Language: en-us' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15')
++ curl -s https://www2.deepl.com/jsonrpc --compressed -H 'Origin: https://www.deepl.com' -H 'Referer: https://www.deepl.com/translator' -H 'Accept: */*' -H 'Content-Type: application/json' -H 'Accept-Language: en-us' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15' --data-binary '{"jsonrpc":"2.0","method": "LMT_handle_jobs","params":{"jobs":[{"kind":"default","raw_en_sentence":"Hello,howareyou?","preferred_num_beams":4,"raw_en_context_before":[],"raw_en_context_after":[],"quality":"fast"}],"lang":{"user_preferred_langs":["EN","DE"],"source_lang_user_selected":"auto","target_lang":"FR"},"priority":1,"timestamp":1557063997314},"id":79120002,"commonJobParams":{"formality":null}}'
+ result='{"jsonrpc":"2.0","id":79120002,"result":{"translations":[{"beams":[{"postprocessed_sentence":"Bonjour, comment allez-vous ?","num_symbols":8},{"postprocessed_sentence":"Bonjour, comment allez-vous ?","num_symbols":8},{"postprocessed_sentence":"Salut, comment allez-vous ?","num_symbols":8},{"postprocessed_sentence":"Bonjour, comment \u00E7a va ?","num_symbols":8}],"quality":"normal"}],"target_lang":"FR","source_lang":"DE","source_lang_is_confident":false,'detectedLanguages":{},"timestamp":1607585734,"date":"20201210"}}
+ [[ {"jsonrpc":"2.0","id":79120002,"result":{"translations":[{"beams":[{"postprocessed_sentence":"Bonjour, comment allez-vous ?","num_symbols":8},{"postprocessed_sentence":"Bonjour, comment allez-vous ?","num_symbols":8},{"postprocessed_sentence":"Salut, comment allez-vous ?","num_symbols":8},{"postprocessed_sentence":"Bonjour, comment \u00E7a va ?","num_symbols":8}],"quality":"normal"}],"target_lang":"FR","source_lang":"DE","source_lang_is_confident":false,"dete == *\"\e\r\r\o\r\"\:\{\"\c\o\d\e\"\:* ]]"date":"20201210"}}
+ echo '{"jsonrpc":"2.0","id":79120002,"result":{"translations":[{"beams":[{"postprocessed_sentence":"Bonjour, comment allez-vous ?","num_symbols":8},{"postprocessed_sentence":"Bonjour, comment allez-vous ?","num_symbols":8},{"postprocessed_sentence":"Salut, comment allez-vous ?","num_symbols":8},{"postprocessed_sentence":"Bonjour, comment \u00E7a va ?","num_symbols":8}],"quality":"normal"}],"target_lang":"FR","source_lang":"DE","source_lang_is_confident":false,"d'tectedLanguages":{},"timestamp":1607585734,"date":"20201210"}}
+ /Users/sylvain/Downloads/deepl-alfred-workflow2-1.19/jq-dist -r '{items: [.result.translations[0].beams[] | {uid: null, arg:.postprocessed_sentence, valid: "yes", autocomplete: "autocomplete",title: .postprocessed_sentence}]}'
{
"items": [
{
"uid": null,
"arg": "Bonjour, comment allez-vous ?",
"valid": "yes",
"autocomplete": "autocomplete",
"title": "Bonjour, comment allez-vous ?"
},
{
"uid": null,
"arg": "Bonjour, comment allez-vous ?",
"valid": "yes",
"autocomplete": "autocomplete",
"title": "Bonjour, comment allez-vous ?"
},
{
"uid": null,
"arg": "Salut, comment allez-vous ?",
"valid": "yes",
"autocomplete": "autocomplete",
"title": "Salut, comment allez-vous ?"
},
{
"uid": null,
"arg": "Bonjour, comment ça va ?",
"valid": "yes",
"autocomplete": "autocomplete",
"title": "Bonjour, comment ça va ?"
}
]
}
I did encounter the same like @sy6sy2 did. But I found a workaround which still doesn't work perfectly.
Here is an example. Single words do not seem to work for ENG > GER but it works for GER > ENG.
❯ ./deepl.sh -l DE "Awesome."
{
"items": [
{
"uid": null,
"arg": "Awesome",
"valid": "yes",
"autocomplete": "autocomplete",
"title": "Awesome"
}
]
}
❯ ./deepl.sh -l DE "This is just an example."
{
"items": [
{
"uid": null,
"arg": "Dies ist nur ein Beispiel",
"valid": "yes",
"autocomplete": "autocomplete",
"title": "Dies ist nur ein Beispiel"
},
{
"uid": null,
"arg": "Dies ist nur ein Beispiel:",
"valid": "yes",
"autocomplete": "autocomplete",
"title": "Dies ist nur ein Beispiel:"
},
{
"uid": null,
"arg": "Dies ist lediglich ein Beispiel",
"valid": "yes",
"autocomplete": "autocomplete",
"title": "Dies ist lediglich ein Beispiel"
},
{
"uid": null,
"arg": "Dies ist nur ein Beispiel unter",
"valid": "yes",
"autocomplete": "autocomplete",
"title": "Dies ist nur ein Beispiel unter"
}
]
}
Tried
dl Bonjour.
ordlfr Hello.
but no result appear.Log:
Thank you!