Multilingual Blogger


When we launched this blog, we faced a challenging problem: how could be deal with the three languages of the course? Multilingual sites are a serious headache, particularly when you have to publish frequently (even with the best tools for that).


In our case, the frequency was not an issue, since this is not a daily blog. Actually, it is for examples and tutorials for our students. If it was a travel blog, it would be crazy to publish in three languages frequently. What a mess!

For our example of Serverless myRIO we had to acquire a domain, and following the recommendations of the tutorial, we bought one at Google Domains. Once you do so, Blogger is included in the price, so it is a no-brainer to choose that platform instead of others.

But, a big but, Blogger does not support multilingual sites. Damn! The recommended way is to create one blog for each language and try and keep them as similar as possible to jump from one to another seamlessly, as if it were one. Additionally, you have to keep some relation between related posts, for example, sharing the same name in every language.

Looking for a solution, we found an inspiring one which combined English and Portuguese:

https://www.broculos.net/2013/05/how-to-create-multilingual-blog-in.html

The idea from Nuno Freitas is great, but for some reason it did not work on our Blogger site. Anyway, the idea of using permalinks was inspiring and we fixed the problem in a quite compact fashion, using the javascript:method syntax to solve the problem.

<a id="esp" href = "javascript:window.location.assign('https://informatica.industriainformatika.pw'+window.location.pathname)">ES</a>

We can use this chunk of code in any HTML/JavaScript block, changing the 'https://...' part with the hostname of the referred language. In our case, we have used the same approach as Nuno and we have the links inside an <ul> list. After all the copy paste stuff, we change the current language link with this:

<a id="eus">EN</a>

And the effect we get is the very same you can see in our blog. It is always great to know a bit of HTML and JavaScript!

By the way, if you want to learn a bit of HTML, JavaScript and the likes, w3schools has fantastic exercises and tutorials and you can do your tests and exercises in their playground, that is, you can run code online without installing anything. We will mention more playgrounds like this in the next posts of this blog. Have fun!

https://www.w3schools.com/