dennis-tra / alfred-dict.cc-workflow

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

Alfred dict.cc workflow

Github All Releases Maintainability

Alfred workflow to get bidirectional translations from dict.cc.

If you like the workflow give this repo a star ⭐

Example animation

And if it saves you time you may consider to

Buy Me A Coffee

Table of Contents

Download

Click here and download Dict.cc.alfredworkflow.

Installation

Just double click the Dict.cc.alfredworkflow file and Alfred should pick it up automatically.

Permissions

Since Catalina, you need to tell MacOS that it's okay to run the included binaries. For that, you have the following two options:

Give execute permissions to the included binaries Open the workflow directory Open workflow directory Right click on the `dictcc_*` binary for your platform (Intel Macs `dictcc_amd64`, M1 Macs `dictcc_arm64`) and select `Open` in the pop up. Open dictcc binary This will open a Terminal window and you should see an error message. However, you have now indicated to MacOS that it's okay to run the binary. Close all windows and you're good to go.
Give execute permissions to Alfred in general Beware that the following configuration applies to all workflows you have currently installed and all future ones. Security & Privacy Setup

Why do I need to do that?

Since MacOS Catalina Apple does not allow running arbitrary binaries unless they are notarized. Developers can notarize their binaries if they enroll for the Apple Developer Program which is around $100 per year. Since I am not enrolled, I can't notarize the binaries, and we need to live with the above inconvenience :/

Supported Languages

English, German, French, Swedish, Spanish, Bulgarian, Romanian, Italian, Portuguese, Russian

Command

dict lang1 lang2 word_to_translate

You can omit lang1 and lang2 to just translate between german and english (both directions!). See below to customise the default language pair.

Possible values for lang1 and lang2:

Abbreviation Language
en, eng english
de, ger german
fr, fra french
sv, swe swedish
es, esp spanish
bg, bul bulgarian
ro, rom romanian
it, ita italian
pt, por portuguese
ru, rus russian

Default Language Pair

You may not want the translations to be between english and german by default. To change this behaviour open the Alfred preferences, go to Workflows, select Dict.cc and click on the Configure workflow and variables button in the top right corner.

Default language setup step 1

You should find the following two workflow environment variables:

  1. from_language
  2. to_language

Default language setup step 2

Assign both variables one of the above abbreviations (either the two letter or three letter form). In the screenshot above the configuration says

to translate between french and english by default.

Note: Although the variables are named from_ and to_ the translations will be bidirectional, so the order shouldn't really matter.

Development

Build the workflow:

GOOS=darwin GOARCH=arm64 go build -o dictcc_arm64 main.go
GOOS=darwin GOARCH=amd64 go build -o dictcc_amd64 main.go

Move both binaries to the workflow folder. For development I'd recommend symlinking them.

Maintainers

@dennis-tra.

Contributing

Feel free to dive in! Open an issue or submit PRs.

Support

It would really make my day if you supported this project through Buy Me A Coffee.

Other Projects

You may be interested in one of my other projects:

License

Apache License Version 2.0 Β© Dennis Trautwein