5 Steps to Build a Drupal 8 Multi-lingual Site

drupal 8 multi lingual

Drupal 8 is a massive undertaking. It’s already been 5 years in the making.

Why did it take so long? Partly because so many important contributed modules are now core features. Translation is a perfect example.

It used to take several contributed modules to make even a small multi-lingual Drupal 7 site. Now, you can translate everything using just the Drupal 8 core.

Here’s our 5-step guide to building your first Drupal 8 multi-lingual site.

Step #1. Enable the translation modules

You will need to enable these four core Drupal modules in order to translate your site:

Step #2. Translate the Drupal core

First, let’s translate of the core language inside the Drupal. In this example, I’m going to add Spanish as an option on my site:

  • Go to Configuration > Languages
  • Click “Add language”
  • Choose your language and click “Add language”.

Click on the percentage area, under “Interface Translation”.

language-strings

You’ll be able to search for and manually translate all the language strings in here:

Step #3. Translate your own site set-up

  • Go to Structure > Content types, you’ll see a “Translate” option for your content types:

Inside the next screen, you’ll see similar “Translate” links for all your fields:

Step #4. Add content

Now we can add content to your Drupal site.

  • Go to Configuration > Content language and translation.
  • Click the box next to “Content”:
  • Check the box, “Show language selector on create and edit pages”.
showlanguage
  • Now go and add content to your site. Thanks to the “Show language selector on create and edit pages” box, you’ll able to choose the language you’re writing in:
  • After saving content, you’ll see a “Translate” tab available:
  • Click “Add” in order to create a new version of that content item:

Congratulations! You can now start translating your Drupal site. And you didn’t use a single contributed module.

Step #5. Allow users to switch between languages

  • Go to Structure > Blocks
  • Click “Place blocks”
  • Click “Place block” next to the “Language Switcher” block:
  • Click “Save block”.
  • Go to the front of your site and the Language Switcher will be working:

One final nice touch is that the URLs were automatically configured. The URLs on my test site looked like this:

  • /node/1
  • /es/node/1

Author

  • Steve Burge

    Steve is the founder of OSTraining. Originally from the UK, he now lives in Sarasota in the USA. Steve's work straddles the line between teaching and web development.

0 0 votes
Article Rating
Subscribe
Notify of
39 Comments
Oldest
Newest
Inline Feedbacks
View all comments
pepperstreet
8 years ago

Indeed, what a relief. Although there is still some “complexity”. Obviously it’s in the nature of the beast. 😉

steve
steve
8 years ago
Reply to  pepperstreet

Yes, there’s still complexity (this post took me quite some time to figure out), but it is better than D7.

pepperstreet
8 years ago

BTW, what about the options to create menuItems during submission? There is a feature to assign a menuitem/root as a default. On first sight, this does not really work in a multi-language site… What if I need to create single node menuItems, and want to make it easy for the author?
Anyways, what’s best practice for multi-lingual menus? Don’t use single node items? Create “auto-menus” with Blocks/Views that list certain nodes automatically?

steve
steve
8 years ago
Reply to  pepperstreet

Hi pepperstreet. I’ve not tested that far yet, I’m afraid.
However, I suspect you’re right: auto-menus might make a lot of sense.

SimonW
8 years ago

Nice sharing. Thanks !

Renate Wesselingh
Renate Wesselingh
8 years ago

I have set up my site from scratch in Multilingual, and all works fine, I can create translated pages very easily. But I run into problems when I want to edit a translated page I created before: I have no way to access it again. In the Translate tab, if I use Edit at the end of the line behind one of my translations, I get the English page in Edit mode. When I click on the title of the translated page, I get the page in Content view, but again in English. The language switcher switches the interface language, but not the content language. So I can add translations, but never edit them once published. How do I solve this?

David
David
8 years ago

If you click the arrow on the Edit button, in the dropdown click Translate. You now get a list of each language version and can click the edit button for which language version you wish to edit. If you are not able to click translate then you have not enabled this content type fields for translation, to do this click Configuration > Regional and Language > Content language and translation. For the content type make sure to tick the box for all the fields you wish to make translatable. Save and it should work now.

Silver
Silver
7 years ago

In my drupal 8 website all is ok but language switcher block is missing. what could be the problem?

Molsen
Molsen
7 years ago
Reply to  Silver

Did you ever figured this out? I’m having the same problem, the Language switcher system block doesn’t exist for me either, if anyone has any ideas let me know!

Chim Raynor
Chim Raynor
7 years ago
Reply to  Silver

There should be a Language Switcher block in the Blocks admin page at admin/structure/block you need to enable it and place it in a region.
UPDATE: after a bit of playing about… You also need to have the url method enabled in the detection and selection page 🙂

apps
apps
7 years ago

Such a Great Tutorial. I was able to get the languages dropdown following above tutorial. I added English and German languages. Now I have a question on the flags that displays next the the languages options. I see USA flag icon for each languages. Where should I add individual flag icon for corresponding countries?
Thanks.

apps
apps
7 years ago
Reply to  apps

Any Suggestions or comments?

steve
steve
7 years ago
Reply to  apps

@apps Sorry, our support team don’t monitor comments, but they are available for members: [url=http://ostraining.com/drupal-support]http://ostraining.com/drupa…[/url]

Lenivetz
Lenivetz
7 years ago

Thanks for the tutorial. It’s much simpler than in Drupal 7.

Nick
7 years ago
Reply to  Lenivetz

You’re very welcome, Leniventz!

Christoph Potzinger
Christoph Potzinger
7 years ago

Unfortunately, in Drupal8 there seems to be a problem with the language switcher. A language link in the language switcher is still clickable if the node doesn’t have a translation for that language. If I have an untranslated node with the url /de/some-text in German, I can still change to English /en/node/12. This doesn’t make sense as it shows the German text. Is there an option to disable this behavior?

Nick
7 years ago

Good question, Christoph! Sign up at [url=https://www.ostraining.com/pricing/]https://www.ostraining.com/…[/url] and one of our Drupal techs will be able to help.

askSA
askSA
7 years ago

Hi Christoph, I ran into the same issue with non-tranlsated nodes, where German is default language.

Did you manage to solve this?

Chris
Chris
7 years ago
Reply to  askSA

As far as I could track the issue down, I am bound to believe this is intented behavior.

smfmoreno
7 years ago

Helo, thank you for this manual!
I’m working with drupal 8 and when i click on the tab “translate” of a content type, i don’t have the the button “add”, only if i active the permision to add translations, but in this case, a register user can translate all content, includes the content of other users! What can i do? Please help! Thank you! Regards

daniel-pickering
7 years ago
Reply to  Sandra

Hi Sandra
Can you check that you have done step 4 correctly please?
Thanks

Daniel

smfmoreno
7 years ago

Hi Daniel,
Thanks for trying to help me. Not exactly… in the type of content I have

activated “Activate translation”, but I have not turned on “show language selector on create

and edit pages” because I’m sure that the user is going to be confused with the

translations! I prefer a clean link to translation. But on the translation tab,

I don’t have the add buttons…(the user has permission to translate this type of content ) anyway, if I set it as the tutorial says, I can only see

the content with the last language created: do not keep the others. I

hope I have expressed myself well. My English is very bad… I’m sorry.
Thank you, Daniel.
Regards,
Sandra

aanbarasan
6 years ago

Dear Instructor ,

When I’m Installing drupal 8 “choosing core original language : “Tamil” selected and installed.

Later Regional and language added the Language “ENGLISH” and set the ENGLISH language to default site language.

But the administration structure menus “Content type,taxonomy , menus, views,etc” not changing inside default language English , outer only changed English but still inside Tamil only.Is there any option to without reinstall change this original language English default or only chance to delete all files and install the drupal again ?

Thanks !!

Hearty thanks again ! sharing the videos and books . Without OSTraining can’t imagine to learn web ..
[urlcomment image]https://uploads.disquscdn.c…[/url] , [urlcomment image]https://uploads.disquscdn.c…[/url] , [urlcomment image]https://uploads.disquscdn.c…[/url]

steve
steve
6 years ago
Reply to  aanbarasan

Hi, In regions and languages you need to set the default (Make sure you have enable all the language options in extend first) and then go to ‘Detection and selection’ And make sure they are selected for that language.

aanbarasan
6 years ago
Reply to  steve

Hi Steve !

Thanks for trying to help me . Sorry Dear Steve still not working 🙁 .

Thanks again for the positive reply .

steve
steve
6 years ago
Reply to  aanbarasan

Hi aanbarasan,
The issue is probably that it didn’t fully install the other language at the first installation. It’s not something I’ve tried in D8 yet. It’s possible it is a bug check the issue cue for languages in D8 [url=https://www.drupal.org/project/issues/drupal?text=&status=Open&priorities=All&categories=All&version=8.x&component=language.module]https://www.drupal.org/proj…[/url]
And if you don’t think it is covered open an issue.

ASHISH MAHAJAN
ASHISH MAHAJAN
6 years ago

Translation is really good in drupal 8 as compared to Drupal 7. But only one thing i noticed, every time when we translate the node it creates the seperate node for the translation and it causes duplicate nodes. But this is handled in Drupal 7 by using entity translation module, that does not creates the seperate node for the translation instead it refer the same node with multiple translation. can we achive the same in drupal 8?

Kazim
Kazim
5 years ago
Reply to  ASHISH MAHAJAN

I too got stuck on the same issue. When we use relationship to join the content types which both have been translated, view produces duplicate records. Even aggregation and distinct are not eliminating them. Pl. suggest a workaround.

Pawan
Pawan
6 years ago

All the translation works but the link in language switcher block not got translated in selected language. Can anyone help me.

luc dengis
luc dengis
6 years ago

Thanks Steve for this very clear guide!

Krishna
Krishna
6 years ago

Hi Steve,

I have setup D8 site and translation works fine. My problem is creating view block of nodes doesn’t show default nodes if translation is not added. It works, if aggregation is on. And if aggregation is on, I am getting all the nodes together than selected language. Could you please explain me how to work with views and translations.

Thanks
Krishna

omkargaonkar14@gmail.com

Your provided Tutorial working fine ….!!! thank you so much for helping me.

Luk
Luk
6 years ago

My multilingual site works just fine. But how can I make the language switcher to show horizontally in the block? I read I should change the css, but they forget to mention which css file it is??

Mingsong
Mingsong
5 years ago

Thanks for this tutorial.

I am trying to translate the title in a routing.yml file. I enable all translation modules as this tutorial said.
Clear all caches and run cron. But the titles defined in routing yml files are still missing from the User interface translation configuration.

Rajesh singh
Rajesh singh
5 years ago

Hello sir..i am working in drupal 8 and facing one issue.. my default language is English and when i try to add translation in french after that time entire site runs in french. do you have any idea why it is happening? can you help me?

Abhinaw Anand
Abhinaw Anand
5 years ago

how to create base url with language code i mean i have two language for both language i have wrote one custom module there i have declare global $base_url; i’m trying access /en for english and /hi fir hindi both like something session how can i make global setting for base_url which session sud be active untill i’m not changing session

Vince Wilding
Vince Wilding
4 years ago

Anyway to change it to a dropdown instead of a bulleted list?  I’ve looked in `configure block` to no avail

Renier John Sediego
Renier John Sediego
4 years ago

Hello  , i have a problem during language switching . I dont want to override language switch by typing url from http://www.mysite.com/ into http://www.mysite.com/ja .Is there another solution?  The default lang is english. Thank You 

krishna priya Tadepalli
krishna priya Tadepalli
3 years ago

how to disable the  enabled language 

39
0
Would love your thoughts, please comment.x
()
x