dennis-tra / alfred-dict.cc-workflow

🌍 Alfred 4/5 workflow to get translations from dict.cc
137 stars 4 forks source link

Broken after update to MacOS Sonoma (14.0) #16

Open mario-hab opened 1 year ago

mario-hab commented 1 year ago

The workflow seems to be broken after the update to the latest MacOS version 14.0. No error is shown, yet the translation is not displayed:

image
muffix commented 1 year ago

Sonoma comes with a newer version of the iconv tool which has new names for a couple of codesets. UTF8-MAC, for example, has been renamed to utf-8. This workflow release calls iconv -f UTF8-MAC <<<'{query}' before passing the output to the go binary. However, this command errors under Sonoma, which causes an empty string to be passed to the workflow.

❯ iconv -f UTF8-MAC <<< 'test'
iconv: iconv_open(, UTF8-MAC): Invalid argument
❯ iconv -f utf-8 <<< 'test'
test

If you double-click the script filter node of the workflow, you can see the call in the first line. Just change UTF8-MAC to utf-8.

@dennis-tra To support both versions, you may want to replace the call with something like this to the node and cut a new release. I'd open a PR, but the info.plist isn't under version control.

QUERY=$(iconv -f utf-8 <<<'{query}' || iconv -f UTF8-MAC <<<'{query}')
michelneeser commented 1 year ago

@muffix This workaround works perfectly, thank you!

dennis-tra commented 1 year ago

Thanks to all of you! I just updated the workflow and cut a new release bundling all the latest additions 👍 https://github.com/dennis-tra/alfred-dict.cc-workflow/releases/tag/v2.1.0

Let me know if you encounter anything else

carstenbauer commented 1 year ago

I've just tested the new release and can confirm that it fixes the issue.

dahei commented 11 months ago

I have 2 macs - one with Ventura, the other with Sonoma. The 2.0.0 works on Ventura, but not Sonoma 2.1.0 is the other way around. Works on Sonoma but not Ventura.

CleanShot 2023-11-16 at 14 23 13@2x CleanShot 2023-11-16 at 14 23 55@2x
dennis-tra commented 11 months ago

Hi @dahei could you try in both of your installations to replace the "Script Filter" with the following snippet and run it?


EXIT_CODE=0
QUERY=$(iconv -f utf-8 <<<'{query}' || EXIT_CODE=$?) # this command can fail

if [ $EXIT_CODE -ne 0 ]; then
    QUERY=$(iconv -f UTF8-MAC <<<'{query}')
fi

# Check for Apple Silicon
if [[ $(uname -m) == 'arm64' ]]; then
  ./dictcc_arm64 "$QUERY"
else
  ./dictcc_amd64 "$QUERY"
fi

Just double click on the script filter here:

image

I'd cut a patch release if this fixes your issue :+1:

dahei commented 11 months ago

I tried that. Now it's not working in either of both os versions. 🤔 CleanShot 2023-11-20 at 15 58 55@2x

arossmann commented 9 months ago

I have the same issue and the workaround is not working. Have Sonoma 14.2.1 (23C71) installed