-1

I want to add a second language to my site. What all do I have to do to enable a language and make it selectable by the user? Also, how can I keep from having all of the content show up twice-- once for the default language (in my case, English) and once for the other language?

I'm using Drupal 8

  • As always, please share the reason for the downvote. – seizethecarp Dec 7 '17 at 19:49
1

To allow a user to select other languages, you need to first enable other languages and then place a selector somewhere on the site. Here are the steps:

  1. Enable other languages from Manage > Extend > Multilingual (check all four boxes-- Configure Translation, Content Translation, Interface Translation, Language)

  2. Configuration > Languages > Add language – whatever language

  3. Configuration > Content Language and translation > check the box next to what you want to be able to have a translated version (like articles or basic page, etc.)
  4. add a language switcher for the end user:

    a. Go to Admin > Structure > Blocks

    b. Click "Place blocks" on the desired region

    c. Click "Place block" next to the "Language Switcher" block

    d. Click "Save block"

    e. Go to a translated node and the Language Switcher will be working

Now if you translate an article it will make a second version of that article, so to prevent both versions from showing up in any lists you have, make any of the Views filter by language:

Under Structure > Views - find any views your site uses and Add "content: translation language" then select the option to filter by "interface text language selected for page"

This is a compilation from How to allow the user to change the language? and https://www.drupal.org/docs/8/multilingual/translating-content and https://www.drupal.org/node/1346242

See also https://www.drupal.org/forum/support/translations/2014-01-27/menu-translation-in-drupal-8#comment-11454369 (in this context https://www.drupal.org/node/2182497) to make sure you enable all items like menus to be translatable

NOTE: selecting all four modules in Multilingual may not be necessary for just displaying a different language option for end users, start with just Language and Content Translation

  • 1
    Thank you for writing a tutorial, but I think there is some danger here because you have two questions: 1) what do I need to do to make the language user-selectable? 2) How can I keep the content from showing up twice in Views? It's not clear which steps answer which parts of which question, and this is important because many people need 1) but do not need 2). – Patrick Kenny Dec 6 '17 at 3:26
  • That's a good point. I think it's clarified now – seizethecarp Dec 6 '17 at 14:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.