0

I'm working on a bilingual website (French and English). The homepage currently shows up as per language detection settings, but I need it to show in French first, with the English version available via language switcher.

Info: Both languages use prefixes, and the language detection settings are ordered as URL>User>Browser>Default (English). The homepage is built with Panels and Views.

I've tried playing with redirects (has no effect) and i18n Variables (results in the page content not being found).

1

At admin/config/system/site-information add your system path (node/1, node/2 or whatever) to Default front page field. (Don't ask why the "prompt" sometimes displays the language prefix, sometimes doesn't, I don't know.)

Language detection settings have no effect here, I think. At least when you have URL first.

  • The only problem with this solution is that the language switcher will not work for the front page either when setting it to a single node and using node translation. Could work well with entity translation though. – tanius Feb 22 '15 at 21:19
  • "Don't ask why the "prompt" sometimes displays the language prefix, sometimes doesn't" – It's a bug! – tanius Feb 23 '15 at 0:05
0

You can use redirects, but you might have to set them up on the web server level. Setting a front page redirect up in Drupal might be too late in the process. So:

  1. Give the path prefix highest priority in the language negotiation settings. Else, URLs would not reliably select a language version. Already done in your case.

  2. Find a URL that loads your French front page content. Options:

    • Something like http://example.com/fr/node/1. For example, if you use Panelizer to panelize a node and to add views to it. Simplest option, but does not look good.

    • Something like http://example.com/fr/home. Uses the node alias instead of the node ID.

    • http://example.com/fr. Nicest URL. If it does not work for you, then possibly because you use Drupal's default front page config field, with which the language switcher does not work. You can make it work by enabling multilingual front page configuration [see here, or here for more details).

  3. Set up a redirect in the web server. For example if you use Apache and the "nicest URL" from above, you can use the mod_alias mechanism in .htaccess:

    Redirect 301 / /fr
    

    (If this does not work for your case, see some details.)

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.