Workflow: Translating Clipboard Text

Whilst I have knowledge of coding languages is reasonably broad my knowledge of spoken and written languages is rather limited. English is pretty much my only language though I can probably get away for asking directions or buy a coffee in a handful of others. It therefore isn’t really a surprise that from time to time I come across information that’s in a language I don’t understand well enough to translate it myself. When I’m at a laptop or desktop computer with an Internet connection I use an online translations service like Google Translate. Sometimes however I’m on an iOS device and whilst I can use such services I decided to put together a little Workflow app workflow to try and speed up the process.

Other than occasionally translating some occasional German or Polish words from some of my international colleagues at work (whose English is far better than my German or Polish) I mainly run into a need to translate when I’m viewing Twitter conversations and mentions. I use Tweetbot which includes a translate feature, but it will only translate the original tweet content. I like to reply in the language of the original post so having a way to get the English, create a reply in English and then translate that into the right language is rather handy.

The workflow I created I named Translat-o-matic and it has a number of areas within it that you may wish to modify to meet your own particular needs. It works with the iOS clipboard and translates the contents to or from the required language. I did originally create it as an action extension, but after using it for a while I simplified it back down to just using the clipboard as I could never quite be sure that I was going to get the text content I wanted whereas when I copy the text to the clipboard I’m pretty much guaranteed to get what I want.

The workflow begins by specifying the default language. This is what the workflow will translate text to and from. For me it’s English, but you may want to change that to your preferred language if it isn’t English.

The workflow next stores a list of languages. These are the languages I translate into most commonly; again you may wish to modify this. It then adds “Other…” to the end of the list so that at run time you can actually specify any workflow compatible language.

The workflow will then grab the clipboard content and try to determine what language the content matches. If that language does not match the default language, the workflow will progress and convert the content of the clipboard in to the default language. If that language does match the default language the workflow will progress and offer a list of languages (and “Other…”) to translate the content of the clipboard into. If the user selects “Other…” at this point, they will be presented with a workflow input that allows them to select from all available languages.

The final action is for the workflow to copy the resulting translation to the device clipboard.

The details of the actions in the workflow can be seen below and you can also download the workflow for yourself.

Author: Stephen Millard
Tags: | workflow | ios |

Buy me a coffeeBuy me a coffee



Related posts that you may also like to read