Don't Get Lost in Translation: Using Google Translate in Alfred
Alfred includes a range of useful web searches, from Google Maps and Apple Maps to IMDB and Rotten Tomatoes. These can be triggered with a keyword followed by your search term.
It's likely that you also have your own favourite websites you use frequently, which is where custom searches come in handy.
You can create your custom searches by taking a look at the URL at the top of your search bar; The objective is to replace the search term with {query}
, so that Alfred knows where to slip your search term into the URL.
I frequently use Google Translate to translate from and to many different languages, and using the keyword "translate" in Alfred is the quickest way to get a translation. However, Google has to make its best guess at which language I'm pasting in, and which language I want it to translate to.
Instead of letting Google play Russian roulette, I've created a few custom searches that specify which languages I want Google to use. This particular custom search ensures that Google predictably knows I'm entering a French sentence and I want the outcome to be in English.
Launch Alfred's preferences to Features > Web Search, where you'll be able to create your own custom search.
Copy the URL format below to create a French to English custom search:
Translate "{query}" from French to English
https://translate.google.com/#fr/en/{query}
And here is the English to French translation URL:
Translate "{query}" from English to French https://translate.google.com/#en/fr/{query}
You can adjust the "fr" and "en" to any language you'd like to use, and tweak some of the custom search preferences. For example, certain sites encode spaces differently, so you'll need to experiment a little.
Create a few of these and you'll be a polyglot in no time! (And don't forget you can use Alfred's "define" keyword if you need to check the meaning of "polyglot"...)