Discover more from The Barracks
How to make an automatic translate button for Substack
Make your newsletters multilingual
Wouldn’t it be great if we were able to use the power of Google Translate (other translation services are available) to make our posts multilingual, and potentially reach a considerably bigger audience?
Well, it’s possible and here is one way of doing it.
Start with the URL of your story. Unfortunately, there isn’t a built in way of doing this on Substack, so you’re going to have to hack it. You should know your own custom substack subdomain - mine is
Get the URL for your post
The way to make a URL for your full post is usually (always?) to follow your subdomain with a
slash-letter p-slash (/p/) combo, then the URLS-safe ttitle you gave your piece.
You make the URL-safe title by replacing all of the spaces between words with dashes and simply removing all of the characters which are not letters. This post, for example, should have the URL of:
But if it were only that simple! My title is “too long” (according to SEO Experts) and so it gets truncated by Substack. You can work out exactly how it gets shortened by counting characters from the last slash and stopping at the end of the last word before you get to the magic number of 48.
You can simply go to Settings in your post creation page (the button looks like this and is bottom right of the page) and scroll down to SEO Options
Click the down arrow to reveal the Options of SEO Options, and there are the bottom you have a “copy link” button. Click it to copy the link.
(It says that my URL is 34 characters out of maximum of 48. This is a lie. My URL slug is 34 characters out of a maximum of 48. If this doesn’t mean anything to you, you can ignore this. It is for pedants only)
Switch out the Substack domain for the Google Translate domain
Starting with the URL you copied from SEO Options above, change all of the dots in the domain name to hyphens, and add the google translate domain name (
substack-com and the next slash. Like this:
Add the translate parameters
Then, in a third and final step add a question mark and the language parameters to the end of everything
They look like this.
Let’s break it down
There are two parameters
_x_tr_sl, we can take it means “source language” and
_x_tr_tl must mean “translated language”. They each have an equals sign to give them a value, and they are joined with an ampersand
The values are the two letter language codes which Google (and many other people) use. They are more-or-less standardised, and the full list supported by Google can be found here (https://cloud.google.com/translate/docs/languages)
I write in English, so the first parameter for me is
en. I want to offer automatic translations to German, so I add de as the second parameter. You should use whichever parameters make most sense to you (and you can definitely add multiple buttons for multiple translations), and add the parameters codes to your URL.
This should give you something like this:
Go to Buttons in the formatting menu at the top of your newsletter post, and select Custom Button to get the following pop-up
Add the text you want displayed and the URL we just generated, and Substack will add the button directly into the text where you were last typing.
This would be great (and very simple) functionality that Substack to add, and they are welcome to pay me a bounty for it if they want. Until they do, though, this is a manual process for doing it. It’s riddled with potential sources to muck it up, but if you’re careful, it should work just fine.
I’d like to add a list of examples of text you could write on the button for any given language, but that’s probably best crowd-sourced, so please add your version of how to say “translate this article” in your language in the comments below.
Happy multilingual posting!
The Pirate Ben