Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

An Alfred workflow to help translate and rewrite text using DeepL API

License

NotificationsYou must be signed in to change notification settings

yohasebe/deepl-alfred-translate-rewrite-workflow

Repository files navigation

Overview

AnAlfred workflow to help you translate and rewrite text using theDeepL API or theDeepl free API.

The selected text can be used in any Mac application via hot keys. The source and target languages are automatically detected from one of the two languages specified in the settingsprimary_lang andsecondary_lang. This means that if you want to translate or rewrite a text, regardless of whether it is in the primary or secondary language, all you have to do is select the text and press a hotkey.

There are other features including:

  • Translate/Rewrite using a special HTML input form
  • Document translation (file uploading and downloading)

Downloads

Current version:1.7.0

Download workflow

Change Log

  • 1.7.0:context parameter (alpha feature) supported (API documentation)
  • 1.6.3: Textbox (Web UI) updated to supportformality
  • 1.6.2:formality setting supported both in "translate" and "rewrite"
  • 1.6.0:formality environment variable supported (default:default)
  • 1.5.2:speak environment variable enabled (default:false)
  • 1.5.1: Improvement of internal process
  • 1.5.0: "deepl-textbox" command added
  • 1.4.0: "check-for-update" command added
  • 1.3.3:open_file environment valuable added
  • 1.3.2: Switched to Alfred's native feature to retrieve selected text for performance and stability
  • 1.3.1: Feature to translate/rewrite using Alfred'suniversal action

Setup

To start using this workflow, be sure to set the environment variablesauth_key,primary_lang, andsecondary_lang first. SeeSetting-up section below.

To translate or rewite text as a universal action, set upselection hotkey and enableworkflow file actions andworkflow universal actions.

Check for Update

Typecheck-for-update and run the workflow. If there is a newer version, click on the "Download" button. The readme/download page on Github will open.

Main Features

Translate text

Translate text insecondary_lang toprimary_lang and vice versa. You can use one of the following methods:

  • Universal action
  • Fallback search
  • Keyworddeepl
  • System clipboard and keyworddeepl-clip
  • User-defined hotkey (→ text currently selected in front-most app is sent)

Rewrite text

Rewrite text in one language by translating it to the other language and translating the resulting text back to the original language again. You can use one of the following methods:

  • Universal action
  • Keyworddeepl with key pressed
  • System clipboard and keyworddeepl-clip with key pressed
  • User-defined hotkey (→ text currently selected in front-most app will be submitted)

Document translation

Translate documents of the type.pptx,docx, or.pdf. Upload the original file and then download the resulting file once the translation is complete. The translated file will be downloaded to the same folder as the original file.

Note:max_characters option is ignored for document translation.

To upload the original file

  1. Specify the target file (using selection hotkey, for instance).
  2. Select "DeepL Upload File" action.
  3. Specify if the translation is fromsecondary_lang toprimary_lang (EN to JA, for instance) or the other way round (JA to EN, for instance).

Or alternatively, you can use a workflow file actionDeepL Upload File.

To download the translated file

  1. Select "DeepL Download File" script filter by typingdeepl-download.
  2. Specify the title of the file from the list.
  3. Download will begin if the translation is complete. Otherwise, the current status (queued, translating, or error) will be displayed .

See alsoDeepL API: Translating documents.

document-translation.mp4

Special Input Form in Default Browser

You can open a special input form in your default browser. To open this form, use the keyworddeepl-textbox or a hotkey. When using this special input form, theprimary_lang andsecondary lang settings are ignored. You can specify the languages using selectors and change modes (translate or rewrite) using radio buttons. These settings are stored in the browser and can be used later.

Monitor Usage

You can check how much text characters you have translated so far in the current billing period as well as the limits you set on DeepL Setting Page. Type in the keyworddeepl-usage.

Requirements

To use this Alfred workflow, you need aDeepL API free orDeepL API Pro account. Create one at the following URL.

https://www.deepl.com/pro/change-plan#developer

Note: The DeepL API is only available to DeepL developer API accounts (free or professional). It is not available (at the time of this writing) for regular personal DeepL accounts.

Setting Up

Before you start using this Alfred workflow, you must set values to the following variables (use[x] button in Alfred's Workflow Setting Panel):

Mandatory Variables

VariableExplanation
authkeyauthentication key for DeepL API
primary_langsets the primary language (usually your native language)
secondary_langsets the secondary language (usually the language you use DeepL for)

Available Languages

CodeLanguage
BGBulgarian
CSCzech
DADanish
DEGerman
ELGreek
ENEnglish
ESSpanish
ETEstonian
FIFinnish
FRFrench
HUHungarian
IDIndonesian
ITItalian
JAJapanese
LTLithuanian
LVLatvian
NLDutch
PLPolish
PTPortuguese
RORomanian
RURussian
SKSlovak
SLSlovenian
SVSwedish
TRTurkish
ZHChinese

What are primary and secondary languages?

This workflow translates/rewrites text written in either of the two languages set in the variablesprimary_lang andsecondary_lang.

If you are a native user of Japanese who often work with text in English, for instance, Setprimary_lang toJA andsecondary_lang toEN.

Options

In addition to the above variables, you can also modify values to the following DeepL API parameters. SeeDeepL API for details.

Optional DeepL Variables

VariableExplanation
formalitysets whether the translated text should lean towards formal or informal language (default,more,less)
split_sentencessets whether the translation engine should first split the input into sentences
preserve_formattingsets whether the translation engine should respect the original formatting

Currently theformality option only works when the target language (secondary_lang in "translation" mode;primary_lang in "rewrite" mode) is one of these:DE,FR,IT,ES,NL,PL,PT-PT,PT-BR,JA, andRU.

Utility Variables

There are a couple of additional parameters you can set to make the workflow more useful for you.

VariableExplanation
use_largetypeuses Alfred's large type functionality
max_characterssets maximum number of characters accepted at a time
ja_text_widthsets width of translated text whensecondary_lang is set toJA (Japanese)
soundrings a chime when finished
speakread aloud the response in the "system speech language" on your Mac
open_fileopen the translation file once download is complete
context_inputallows the user to enter context during execution from Alfred interface

Withuse_largetype disabled, the workflow creates/updates a text file in the home directory (~/deepl-translate-rewrite-latest.txt) and opens it in the default text editing app.

Text to Speech

If thespeak variable is settrue, the result text will be read aloud in the system's standard language and voice. To change the language and speech, go to[Accessibility] -[Vision] -[Spoken Content] in the Mac Settings panel.

spoken-content-panel

Author

Yoichiro Hasebe (yohasebe@gmail.com)

License

The MIT License

Disclaimer

Please make sure you understandthe difference between the DeepL free API and the Deepl pro API.

The author of this software takes no responsibility for any damage that may result from using it.

About

An Alfred workflow to help translate and rewrite text using DeepL API

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp