Posted by fletchgqc on August 27, 2008 at 8:55pm
Hi everyone,
I was just working through some detailed i18n issues and started to wonder - does anyone actually use the language negotiation setting: Path prefix with language fallback? It occurred to me that this option is probably fairly unused (especially in D6 as people tend to leave the default language with no path prefix). However perhaps there is a great reason to use it that I'm not aware of. If someone is using it please let us know why, and why you feel it works best for your site.
Comments
I presume this is what
I presume this is what allows browser language detection? I tried it and it worked ok, but I have not yet resolved some problems which arose as a consequence.
Yeah, I didn't think anyone
Yeah, I didn't think anyone was actually using it.
Language detection
I wrote a patch to add "language detection" as a language negotiation setting, so authenticated users can choose the language they prefer and anonymous users will see the site in their browser language.
Here is the issue and patch: http://drupal.org/node/335699
If it worked ! !
Hi,
I would use it ... if it worked !
Or may be I don't understand the way it works.
I thought using this, the user will be set directly to the page version according to preferences defined for the browser: that seems to work.
But switching to another language (using the Switch Language block) doesn't anymore: either the language page stays the same or I get a page not found error.
Keeping the abaility of switching languages is very important for me: for translation, but also for users who want to override their browser setting.
So for me, at the moment, this option does not work.
I use it, and it works well.
I've been using path prefix with language fallback on several multi-lingual sites now and it works well.
Our sites tend to be international so it's handy that without a language specified in the path (as per a user's first visit) this negotiation will detect the language from the browser strings - all links on the rendered pages then include the language path to allow the detected language to persist. Switching language is possible by changing the prefix, although to force the site to the default language requires a language prefix to be set in the default language configuration otherwise negotiation auto-detects again.
'Page not found' errors in my experience tend to be due to the menu module not being able to find an appropriate path for that language - and would likely be common with any of the path prefix negotiation modes.
Multi-lingual sites are not easy, but understand how Drupal applies its logic and you can normally prevail.
I beg to differ
This option does not work out of the box, which in my book means it simply doesn't work.
With a site set to default English, and this option set, accessing the site with an Italian language browser and no prefix correctly displays the home page in Italian. Of course, you cannot switch to English as there is no difference between the Italian default negotiated path and the English default language path (they both are 'http://example.com'). The English language browser works because it defaults to English (or gets set that way from browser preferences) and http://example.com/it correctly displays English.
Clicking on any link is also broken this way.
If I have a link to alias "my-page" (English), the link appears correctly in the English language switcher on my Italian version of the page. But when I click on the link, Drupal sends me to http://example.com/it/my-page, which is a non-existant link. This is not due to configuration problems, it is simply wrong. The correct link is http://example.com/my-page, and Drupal breaks it by adding 'it/', due to my browser settings.
I'd love to know how you got this working.
Aaron Craig
http://about.me/aaron.craig
Upon further investigation, I
Upon further investigation, I have found it is possible to get this working, by setting a language prefix for English, which is not the default.
http://drupal.org/node/338055
Aaron Craig
http://about.me/aaron.craig
Doesn't play well with caching
Path prefix with language fallback should be avoided if you have enabled caching. The issue is explained here: http://drupal.org/node/339958
Peacog Web Development - Freelance Drupal Developer