Posted by David Latapie on April 8, 2010 at 11:20pm
Scenario:
I own a website in French. Someone from the UK visits my website (with an English browser of course). Drupal recognizes its language and serves the English version of the page.
How to do this ?
Content-negociation based on the browser language (Accept-Language in Apache terms, but I don't know it has any importance with Drupal, I think). That seems pretty basic to me, bt I may be wrong (I am not a coder).
- Does Locale (core) suffices or do I need an extra module? If yes, which one? i18n?
- I created a front page, activated Locale, added English as a language and started translating the page (with the Translate tab). Now, I have a nice "English" link at the bottom of my page. This is not what I want. What I want is invisible switching to English
- I stuck with the basic "none" option at
/admin/settings/language/configure
I tried for days to find a way!
Thank you
Comments
Path prefix with language
Path prefix with language callback is the option you are looking for on admin/settings/language/configure.
In your case I would set the default language to French and translate into English.
Understood
What I did not get intially is that complete invisibility is not possible (and may be not desirable since there would be no easy way to evade it. That there must be a hint in the URL.
I finally understood it thanks to this tutorial.
Still some difficulties
I am still experiencing difficulties:
/fr/nodedefaults to/node. No problem here./en/nodeshows a default page instead of the English translation! The good point is that the interface is in English./drupal/and let Drupal do its job or must I explicitely point them to/drupal/en/? I'd prefer the former.On point 3 and 4, I need help. Thank you.
P.-S.: by the way, the spam filter gets really annoying. I can't even write one URL.
Easier with Drupal 7
Drupal 7 makes it clear that browser detection is an option. Take a look at this (short-live) screenshot: http://scriptarium.fr/tmp/Image_2.png
The translation links can be
The translation links can be switched off (somewhere in the language admin pages, cant remember exactly where.)
You could use sub-domain based language instead of prefix. So you get www.en.mysite.com and www.fr.mysite.com etc. Arguably more elegant.
Multilink Redirect (http://drupal.org/project/multilink) might be useful.
Currently part of the team at https://lastcallmedia.com in a senior Drupal specialist role.