Giter Club home page Giter Club logo

Comments (21)

Odaeus avatar Odaeus commented on June 29, 2024 1

Came here to report that I have the same error in the debugger except instead of nothing, it shows the word I entered back to me without translation.

from deepl-alfred-workflow2.

AlexanderWillner avatar AlexanderWillner commented on June 29, 2024 1

Got it, workflow v1.9 was working, v1.11 is not...I've to check the underlying issue.

from deepl-alfred-workflow2.

AlexanderWillner avatar AlexanderWillner commented on June 29, 2024
  • I see the same behaviour here
  • It's not an issue with the underlying scripts or the API
  • actually, you've to configure what you want to translate in the environment variables (workflow > (x) > Environment Variables)
  • by default it translates to english
[13:43:41.581] Deepl-Translate[Script Filter] Queuing argument 'Nein.'
[13:43:41.936] Deepl-Translate[Script Filter] Script with argv '(null)' finished
[13:43:41.947] Deepl-Translate[Script Filter] {
  "items": [
    {
      "uid": null,
      "arg": "No",
      "valid": "yes",
      "autocomplete": "autocomplete",
      "title": "No"
    }
  ]
}
image

from deepl-alfred-workflow2.

gmdelisle avatar gmdelisle commented on June 29, 2024

Yes I have all that configured on the workflow's configuration complete with my Deepl Key.

SCR-20231203-lvek

If I add these values as Environment variables as well I get a warning from Alfred.
SCR-20231203-lwaa

I tried erasing everything in the Configuration builder and use only Environment variables to no avail.
Using Alfred 5.1.4, Alfred 5 workflow v1.11.

from deepl-alfred-workflow2.

AlexanderWillner avatar AlexanderWillner commented on June 29, 2024

Ok, I guess I found it.

  1. What if you press return?
  2. What if you use the keyword dl-to-en instead?

from deepl-alfred-workflow2.

gmdelisle avatar gmdelisle commented on June 29, 2024

Hi,
I really appreciate the follow-up!

I'm sorry to report that I have the same issue.
Still get the same Output, but now with added error about jq.
Using Alfred 5.1.4, Alfred 5 workflow v1.13.

Deepl-Translate[Script Filter] Queuing argument 'nein' Deepl-Translate[Script Filter] Script with argv '(null)' finished ERROR: Deepl-Translate[Script Filter] Code 1: Binary 'jq' not found. Install it via 'brew install jq'.

Installed Homebrew and JQ just to be sure. Still the same.

from deepl-alfred-workflow2.

AlexanderWillner avatar AlexanderWillner commented on June 29, 2024

OK, then the issue is clear. Version 2.0.0 (just released) should fix this.

from deepl-alfred-workflow2.

gmdelisle avatar gmdelisle commented on June 29, 2024

High-five for a quick response! Wow. šŸ™

Same issue here.
FYI not experiencing any other issues with other workflows.

This time getting a slightly different error.

[23:57:20.471] Deepl-Translate[Script Filter] Queuing argument 'nein.'
[23:57:21.040] Deepl-Translate[Script Filter] Script with argv '(null)' finished
[23:57:21.050] ERROR: Deepl-Translate[Script Filter] Code 1: execution error: Error: SyntaxError: JSON Parse error: Unexpected EOF (-2700)

Config is default. Have tried removing my DeelL API key to no avail. If ever there are steps you want me to try, let me know.
image

Appreciate the help.

from deepl-alfred-workflow2.

AlexanderWillner avatar AlexanderWillner commented on June 29, 2024

Ok, let's find the issue:

  1. Go to Alfred settings > Workflows > Deepl-Translate > right click > Open in Terminal
  2. Run bash -x deepl.sh -l EN "nein."
  3. Copy and paste the output here

from deepl-alfred-workflow2.

gmdelisle avatar gmdelisle commented on June 29, 2024

Here you go!
Hope this helps you see what the problem is.

+ LANGUAGE=EN
+ LANGUAGE_SOURCE=auto
+ LANGUAGE_PREFERRED='["DE","EN"]'
+ KEY=
+ PRO=
+ POSTFIX=.
+ VERSION=2.0
+ PATH=/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/usr/local/bin/
+++ dirname deepl.sh
++ cd .
++ pwd
+ DIR='/Users/macos/Library/CloudStorage/Dropbox/PreĢfeĢrences Alfred/Alfred.alfredpreferences/workflows/user.workflow.8E688CE1-8565-45D9-944F-7C43DF4CD1E2'
+ POSITIONAL=()
+ [[ 3 -gt 0 ]]
+ key=-l
+ case "$key" in
+ LANGUAGE=EN
+ shift
+ shift
+ [[ 1 -gt 0 ]]
+ key=nein.
+ case "$key" in
+ POSITIONAL+=("$1")
+ shift
+ [[ 0 -gt 0 ]]
+ set -- nein.
+ '[' -z nein. ']'
+ query=nein.
++ echo nein.
++ sed 's/\"/\\\"/g'
+ query=nein.
++ echo nein.
++ sed 's/'\''/\\'\''/g'
+ query=nein.
++ echo nein.
++ iconv -f utf-8-mac -t utf-8
++ xargs
+ query=nein.
+ [[ '' = '' ]]
+ [[ nein. != *\. ]]
++ echo nein.
++ sed 's/\.$//'
+ query=nein
+ data='{"jsonrpc":"2.0","method": "LMT_handle_jobs","params":{"jobs":[{"kind":"default","raw_en_sentence":"nein","preferred_num_beams":4,"raw_en_context_before":[],"raw_en_context_after":[],"quality":"fast"}],"lang":{"user_preferred_langs":["DE","EN"],"source_lang_user_selected":"auto","target_lang":"EN"},"priority":-1,"timestamp":1557063997314},"id":79120002}'
+ HEADER=(--compressed -H 'authority: www2.deepl.com' -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')
+ '[' -n '' ']'
++ curl -s https://www2.deepl.com/jsonrpc --compressed -H 'authority: www2.deepl.com' -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":"nein","preferred_num_beams":4,"raw_en_context_before":[],"raw_en_context_after":[],"quality":"fast"}],"lang":{"user_preferred_langs":["DE","EN"],"source_lang_user_selected":"auto","target_lang":"EN"},"priority":-1,"timestamp":1557063997314},"id":79120002}'
+ result='{"jsonrpc":"2.0","id":79120002,"result":{"translations":[{"beams":[{"postprocessed_sentence":"nein","num_symbols":3}],"quality":"normal"}],"target_lang":"EN","source_lang":"EN","source_lang_is_confident":false,"detectedLanguages":{"EN":0.020787,"DE":0.040136,"FR":0.011696999999999999,"ES":0.01813,"PT":0.010837,"IT":0.011158,"NL":0.028071,"PL":0.011411,"RU":0.012218,"ZH":0.010069999999999999,"JA":0.011035999999999999,"BG":0.009132999999999999,"CS":0.020419,"DA":0.020047,"EL":0.008643,"ET":0.007956999999999999,"FI":0.026715,"HU":0.014846999999999999,"LT":0.014365,"LV":0.012298,"RO":0.016255,"SK":0.013446999999999999,"SL":0.015749,"SV":0.01452,"TR":0.008945999999999999,"ID":0.013646,"UK":0.01048,"KO":0.0'883,"NB":0.019434,"unsupported":0.5587179999999999}}}
+ [[ {"jsonrpc":"2.0","id":79120002,"result":{"translations":[{"beams":[{"postprocessed_sentence":"nein","num_symbols":3}],"quality":"normal"}],"target_lang":"EN","source_lang":"EN","source_lang_is_confident":false,"detectedLanguages":{"EN":0.020787,"DE":0.040136,"FR":0.011696999999999999,"ES":0.01813,"PT":0.010837,"IT":0.011158,"NL":0.028071,"PL":0.011411,"RU":0.012218,"ZH":0.010069999999999999,"JA":0.011035999999999999,"BG":0.009132999999999999,"CS":0.020419,"DA":0.020047,"EL":0.008643,"ET":0.007956999999999999,"FI":0.026715,"HU":0.014846999999999999,"LT":0.014365,"LV":0.012298,"RO":0.016255,"SK":0.013446999999999999,"SL":0.015749,"SV":0.01452,"TR":0.008945999999999999,"ID":0.013646,"UK":0.01048,"KO":0.00883, == *\"\e\r\r\o\r\"\:\{\"\c\o\d\e\"\:* ]]99999}}}
+ osascript -l JavaScript -e 'function run(argv) {
      const translations = JSON.parse(argv[0])["result"]["translations"][0]["beams"].map(item => ({
        title: item["postprocessed_sentence"],
        arg: item["postprocessed_sentence"]
      }))

      return JSON.stringify({ items: translations }, null, 2)
    }' '{"jsonrpc":"2.0","id":79120002,"result":{"translations":[{"beams":[{"postprocessed_sentence":"nein","num_symbols":3}],"quality":"normal"}],"target_lang":"EN","source_lang":"EN","source_lang_is_confident":false,"detectedLanguages":{"EN":0.020787,"DE":0.040136,"FR":0.011696999999999999,"ES":0.01813,"PT":0.010837,"IT":0.011158,"NL":0.028071,"PL":0.011411,"RU":0.012218,"ZH":0.010069999999999999,"JA":0.011035999999999999,"BG":0.009132999999999999,"CS":0.020419,"DA":0.020047,"EL":0.008643,"ET":0.007956999999999999,"FI":0.026715,"HU":0.014846999999999999,"LT":0.014365,"LV":0.012298,"RO":0.016255,"SK":0.013446999999999999,"SL":0.015749,"SV":0.01452,"TR":0.008945999999999999,"ID":0.013646,"UK":0.01048,"KO":0.008'3,"NB":0.019434,"unsupported":0.5587179999999999}}}
{
  "items": [
    {
      "title": "nein",
      "arg": "nein"
    }
  ]
}

from deepl-alfred-workflow2.

AlexanderWillner avatar AlexanderWillner commented on June 29, 2024
  • Mh, this looks more or less how it should. It says: the translation is nein (well, it should be no but this is somehow related to DeepL that it does not recognize the input language based on a single word if not API key is given). The answer is a valid JSON that should be shown in Alfred. However, above you quoted the error Error: SyntaxError: JSON Parse error: Unexpected EOF (-2700).
  • So you're writing dl nein and it does not return a valid result, right? To avoid confusion, try to translate a more complex input.
image

from deepl-alfred-workflow2.

gmdelisle avatar gmdelisle commented on June 29, 2024

Yep, I have tried translating "Ich spiele gerne Musik."

Here is the output. I do see the translation in the output below, however is does not work with Alfred directly.
image

+ LANGUAGE=EN
+ LANGUAGE_SOURCE=auto
+ LANGUAGE_PREFERRED='["DE","EN"]'
+ KEY=
+ PRO=
+ POSTFIX=.
+ VERSION=2.0
+ PATH=/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/usr/local/bin/
+++ dirname deepl.sh
++ cd .
++ pwd
+ DIR='/Users/macos/Library/CloudStorage/Dropbox/PreĢfeĢrences Alfred/Alfred.alfredpreferences/workflows/user.workflow.8E688CE1-8565-45D9-944F-7C43DF4CD1E2'
+ POSITIONAL=()
+ [[ 3 -gt 0 ]]
+ key=-l
+ case "$key" in
+ LANGUAGE=EN
+ shift
+ shift
+ [[ 1 -gt 0 ]]
+ key='Ich spiele gerne Musik.'
+ case "$key" in
+ POSITIONAL+=("$1")
+ shift
+ [[ 0 -gt 0 ]]
+ set -- 'Ich spiele gerne Musik.'
+ '[' -z 'Ich spiele gerne Musik.' ']'
+ query='Ich spiele gerne Musik.'
++ echo 'Ich spiele gerne Musik.'
++ sed 's/\"/\\\"/g'
+ query='Ich spiele gerne Musik.'
++ echo 'Ich spiele gerne Musik.'
++ sed 's/'\''/\\'\''/g'
+ query='Ich spiele gerne Musik.'
++ echo 'Ich spiele gerne Musik.'
++ iconv -f utf-8-mac -t utf-8
++ xargs
+ query='Ich spiele gerne Musik.'
+ [[ '' = '' ]]
+ [[ Ich spiele gerne Musik. != *\. ]]
++ echo 'Ich spiele gerne Musik.'
++ sed 's/\.$//'
+ query='Ich spiele gerne Musik'
+ data='{"jsonrpc":"2.0","method": "LMT_handle_jobs","params":{"jobs":[{"kind":"default","raw_en_sentence":"Ich spiele gerne Musik","preferred_num_beams":4,"raw_en_context_before":[],"raw_en_context_after":[],"quality":"fast"}],"lang":{"user_preferred_langs":["DE","EN"],"source_lang_user_selected":"auto","target_lang":"EN"},"priority":-1,"timestamp":1557063997314},"id":79120002}'
+ HEADER=(--compressed -H 'authority: www2.deepl.com' -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')
+ '[' -n '' ']'
++ curl -s https://www2.deepl.com/jsonrpc --compressed -H 'authority: www2.deepl.com' -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":"Ich spiele gerne Musik","preferred_num_beams":4,"raw_en_context_before":[],"raw_en_context_after":[],"quality":"fast"}],"lang":{"user_preferred_langs":["DE","EN"],"source_lang_user_selected":"auto","target_lang":"EN"},"priority":-1,"timestamp":1557063997314},"id":79120002}'
+ result='{"jsonrpc":"2.0","id":79120002,"result":{"translations":[{"beams":[{"postprocessed_sentence":"I like to play music","num_symbols":6},{"postprocessed_sentence":"I like playing music","num_symbols":5},{"postprocessed_sentence":"I enjoy playing music","num_symbols":5},{"postprocessed_sentence":"I love playing music","num_symbols":5}],"quality":"normal"}],"target_lang":"EN","source_lang":"DE","source_lang_is_confident":false,"detectedLanguages":{"EN":0.00035299999999999996,"DE":0.9164049999999999,"FR":0.000056999999999999999,"PT":0.000014999999999999999,"IT":0.00037999999999999997,"NL":0.0075899999999999999,"PL":0.002718,"CS":0.000129,"DA":0.021681,"ET":0.000147,"FI":0.000018999999999999999,"LT":0.000009999999999999999,"RO":0.00018999999999999998,"SK":0.00098,"SL":0.000024999999999999999,"SV":0.0011669999999999999,"TR":0.000165,"ID":0.000032999999999999999,"NB":'.005026,"unsupported":0.042893999999999998}}}
+ [[ {"jsonrpc":"2.0","id":79120002,"result":{"translations":[{"beams":[{"postprocessed_sentence":"I like to play music","num_symbols":6},{"postprocessed_sentence":"I like playing music","num_symbols":5},{"postprocessed_sentence":"I enjoy playing music","num_symbols":5},{"postprocessed_sentence":"I love playing music","num_symbols":5}],"quality":"normal"}],"target_lang":"EN","source_lang":"DE","source_lang_is_confident":false,"detectedLanguages":{"EN":0.00035299999999999996,"DE":0.9164049999999999,"FR":0.000056999999999999999,"PT":0.000014999999999999999,"IT":0.00037999999999999997,"NL":0.0075899999999999999,"PL":0.002718,"CS":0.000129,"DA":0.021681,"ET":0.000147,"FI":0.000018999999999999999,"LT":0.000009999999999999999,"RO":0.00018999999999999998,"SK":0.00098,"SL":0.000024999999999999999,"SV":0.0011669999999999999,"TR":0.000165,"ID":0.000032999999999999999,"NB":0.005 == *\"\e\r\r\o\r\"\:\{\"\c\o\d\e\"\:* ]]
+ osascript -l JavaScript -e 'function run(argv) {
      const translations = JSON.parse(argv[0])["result"]["translations"][0]["beams"].map(item => ({
        title: item["postprocessed_sentence"],
        arg: item["postprocessed_sentence"]
      }))

      return JSON.stringify({ items: translations }, null, 2)
    }' '{"jsonrpc":"2.0","id":79120002,"result":{"translations":[{"beams":[{"postprocessed_sentence":"I like to play music","num_symbols":6},{"postprocessed_sentence":"I like playing music","num_symbols":5},{"postprocessed_sentence":"I enjoy playing music","num_symbols":5},{"postprocessed_sentence":"I love playing music","num_symbols":5}],"quality":"normal"}],"target_lang":"EN","source_lang":"DE","source_lang_is_confident":false,"detectedLanguages":{"EN":0.00035299999999999996,"DE":0.9164049999999999,"FR":0.000056999999999999999,"PT":0.000014999999999999999,"IT":0.00037999999999999997,"NL":0.0075899999999999999,"PL":0.002718,"CS":0.000129,"DA":0.021681,"ET":0.000147,"FI":0.000018999999999999999,"LT":0.000009999999999999999,"RO":0.00018999999999999998,"SK":0.00098,"SL":0.000024999999999999999,"SV":0.0011669999999999999,"TR":0.000165,"ID":0.000032999999999999999,"NB":0.'05026,"unsupported":0.042893999999999998}}}
{
  "items": [
    {
      "title": "I like to play music",
      "arg": "I like to play music"
    },
    {
      "title": "I like playing music",
      "arg": "I like playing music"
    },
    {
      "title": "I enjoy playing music",
      "arg": "I enjoy playing music"
    },
    {
      "title": "I love playing music",
      "arg": "I love playing music"
    }
  ]
}

from deepl-alfred-workflow2.

gmdelisle avatar gmdelisle commented on June 29, 2024

Just wanted to add that I have 2 Macs.

  • MacBook Pro 16 M1
  • MacBook Air M2
    Same issue on both.

from deepl-alfred-workflow2.

AlexanderWillner avatar AlexanderWillner commented on June 29, 2024

from deepl-alfred-workflow2.

gmdelisle avatar gmdelisle commented on June 29, 2024

Sure thing, but I've tried it on my Mac I couldn't find deepl.sh.

I do see this file exists in your source code, but I just installed the workflow directly. How would I replace this bash script on my Mac?

from deepl-alfred-workflow2.

AlexanderWillner avatar AlexanderWillner commented on June 29, 2024
  • Go to Alfred settings > Workflows > Deepl-Translate > right click > Open in Finder
  • But I'll just push an update in parallel (only for getting debug information, not fixing it)

from deepl-alfred-workflow2.

gmdelisle avatar gmdelisle commented on June 29, 2024

Yes it's spitting out a bit more info but not much as far as I can judge. Hope this helps!

[11:33:23.052] Logging Started...
[11:33:26.723] Deepl-Translate[Script Filter] Queuing argument 'Ich mag Klassik'
[11:33:28.318] Deepl-Translate[Script Filter] Script with argv '(null)' finished
[11:33:28.324] STDERR: Deepl-Translate[Script Filter] execution error: Error: SyntaxError: JSON Parse error: Unexpected EOF (-2700)
ERROR: Input ''

from deepl-alfred-workflow2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.