Adding as many languages as you want
Initially, I designed the program for 2 languages only so it’s simple to use for regular users, but you can add as many as you want, and here’s how.
Adding 2 languages first follows this tutorial, then follow this tutorial.
It’s important that you customize the theme and save it, because when we add new features, you might have to redo again.
Two steps to add infinity language (repeat).
#1. Edit file language-dropdown.hbs
Find the file language-dropdown.hbs
at the path ./partials/nav/language-dropdown.hbs
and open it. You will se the block code as below (line 16):
You need remove {{!--
and --}}
, we will have the block as below in final:
Replace 3 places with your language you want, for example de
or tr
,etc
Replace 3 places with your language you want, for example de or tr ,etc
{{#match @site.locale "!=" "fr"}}
https://yourdomain.com/fr/
fr
(text)
Save it and done.
Adding new languages is as simple as duplicating the code block.
#2. Edit file multilingual-tags.hbs
Find the file multilingual-tags.hbs
at the path ./partials/site-wide/multilingual-tags.hbs
and open it.
You need remove {{!--
and --}}
(line 7) and change https://yourdomain.com/fr/{{slug}}/
and fr
into your domain with 3rd language you want.
For example:
Save it and done.