2

Content and interface are displayed correctly but the language switcher shows the default language when the language negotiation is set to these options:

  • URL (language prefix)
  • Browser
  • Standard

Means: Browser detection leads to displaying content in german for example, but the language switcher itself shows still "english" as selected. Even when clicking on it the language still is german.

This only happens on the front page, on other paths the prefix takes effect and the switcher shows the correct, selected language.

Any ideas how to fix this? Thanks in advance!

EDIT: The frontpage is designed with translated blocks only, there's no node to point the multilingual variable to. For multilingual we have following modules installed and used: - Internationalization (i18n) - Block languages (i18_block) - Multilingual content (i18n_node) - String translation (i18n_string)

For each language there are several "standalone" blocks, meaning not translated via the block translation option. Visibility is set through these settings:

enter image description here

  • 1
    FWIW, I haven't done a multilingual site since 6.x but I vaguely recall having to create a node for the front page (set to "language neutral") in order to get my switcher working properly. Of course you'd have to point to it in the Site information settings. – othermachines Sep 3 '15 at 14:43
0
+50

It could well be that your issue is due to the fact that you do not have any nodes (Drupal without ANY nodes ... go figure ... a CMS without any "real" Content). So to get it to work you may have to make Drupal give "a few nodes" (i.e. 1 for each language ...).

If you agree, and based on what is described in Multi-language website and language switcher in front page, you may want to try if the steps below, or a subset of it, resolve your issue (probably replacing all 'IT' by something like 'GE' for 'German'):

  1. Assign "path prefix only" to the language settings.
  2. Assign the prefix EN for English.
  3. Created an IT front page (e.g. node/1), chose language IT and leave the menu link title empty in the primary links (you probably want to leave the body empty also).
  4. Create the EN front page (e.g. node/2), chose language EN and leave the menu link title empty in the primary links as well. You probably want to leave the body empty also, though for testing purposes you may temporary want to put some visible content in it also.
  5. In both the IT page and the EN page check "promoted to front page" in the publishing options.
  6. Not sure if you need this step also (first try by skipping this step): in Administer > Site building > Menus > Primary links, create a menu item for "Home" and assign its path to "front", parent item "primary links" and language "all languages".
  7. In "Site information", put "node" as default front page.
  8. Check if your language switcher now works fine: verify if it changes the content from node/1 to node/2 (each of them with their related blocks to be shown) based on selected language. If you also performed step 6, then verify if the primary link "Home" always goes to the corresponding front page (and related blocks).
  • Pierre, thanks for your comprehensive answer. But i can't get it to work, i have tried as well on a vanilla drupal install with just the needed modules. I have tried with your "node"-suggestion in "site information" as well as the option to do it with the "multilingual variables" and set the specific nodes as front pages. Did you get your step-by-step to work? – Volker Sep 8 '15 at 12:02

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.