Language selection conflict cause by English not having a language path prefix.
This occurs in multilingual, non default English, websites.
Implied default: When no path prefix is given (eg: my.website.org) then English is the default.
In the following situations there is a conflict which makes that it is not possible
to select or switch to English, neighter by the language switching block nor by
using a path prefix because English does not have a path prefix.
1: A language different from English is set as default.
2: Language negotiation setting "Path prefix only" is set.
3: Language negotiation setting "Path prefix with language fallback" is set.
Ref: issue "http://drupal.org/node/199624" dd december 2007 given the status By design!
It cannot be that features do not work by design.
Also i believe implementation is goin on for Drupal-7. So why not for Drupal-6.
Comment | File | Size | Author |
---|---|---|---|
#29 | language_path_prefixes-338055-29.patch | 3.57 KB | plach |
#28 | language_path_prefixes-338055-28.patch | 3.64 KB | plach |
#24 | language_path_prefixes-338055-24.patch | 3.57 KB | plach |
Comments
Comment #1
GuyveR800 CreditAttribution: GuyveR800 commentedGiving English a path prefix solves the problem, doesn't it?
It should probably be documented better, but it definitely is this way by design. You can choose to remove the path prefix for the default language, giving you paths without a prefix in the common case. By default Drupal chooses this common case to be English, which is simply a (IMHO logical) choice.
Personally I strongly believe path prefixes or other URL mechanisms are not the way to go, but that is another matter entirely.
Comment #2
hovel CreditAttribution: hovel commentedYes it does.
I see what you mean now. By default drupal does not set a path prefix for the English language.
You can choose to set it anyway. But then you must know that not setting it might be a problem.
There is no problem in a multilingual site where English is the default language. The problem emerges
when choosing an other default language. In this case the default language would have a path prefix
and the English language would not === Problem!
To be consistent Drupal should (automatically?) change the path prefix settings when an admin changes the default language, such that it is always the default language that does not have the path prefix set.
So there is a (design?) problem after all in that Drupal allows to make inconsistent settings.
I think i can agree with you.
Thanks for you reply.
Comment #3
GuyveR800 CreditAttribution: GuyveR800 commentedAt the language prefix configuration form Drupal should print a warning when a language has no prefix and is not the default language either.
Something along the lines of "The missing prefix for non-default language [language] can make that language inaccessible."
Comment #4
XanoI suggest requiring a prefix for all languages, no matter if language negotiation is set to "Path prefix" or not. This is the simplest and most effective solution IMO.
Comment #5
XanoOf course, prefix fields need to be required.
Comment #6
GuyveR800 CreditAttribution: GuyveR800 commentedIndeed it is simple and effective, but it breaks current behaviour.
There is only a problem if the language without prefix is not also the default language.
In other words, the only language that should be allowed NOT to have a prefix is the default language.
Enforcing that fixes the problem and does not break current behaviour.
Comment #7
XanoYes, but that makes it relatively complicated for administrators, since if they want to change the default language to one without a prefix, they will have to go to its configuration page and add a prefix before they can actually make the language the default. Requiring a prefix for all languages makes this whole behaviour a lot simpler. This will hardly be a problem, since proper prefixes are already provided by _locale_get_predefined_list(). Only for exotic languages administrators will have to provide a prefix themselves and even this is easy compared to the complicated behaviour you suggest.
Comment #8
GuyveR800 CreditAttribution: GuyveR800 commentedYou can already only have 1 language without a prefix, all others are required to have one. Currently, Drupal ships with English the default language, without a prefix. The problem occurs when an admin decides to change the default language, but leave English without a prefix.
The least complicated for administrators is to ship Drupal with a prefix for English, but conscious admins should still be able to remove the prefix for the default language. In that case, the only complication occurs when such an admin later wants to change the default language, which can only happen if he first provides a prefix for the current default (or automatically generate the prefix for him using that _locale_get_predefined_list() function when he switches away from a non-prefixed default).
Comment #9
XanoWhy would anyone want to remove the prefix? It doesn't do anybody any harm if it's there, but not being used. If you allow one language to have no prefix things get unnecessarily complicated, because it depends on your config which language doesn't have to have a prefix. Ergo, there is no consistency and things get complicated without need for it. Adding the prefix for English by default and requiring a prefix for all other languages is hardly more work for administrators, but Drupal's inner workings will be much more transparent this way.
Comment #10
GuyveR800 CreditAttribution: GuyveR800 commentedI'm just thinking about maintaining backward compatibility. The reason this feature exists in D6 is probably this: If your site is predominantly one language, you can remove its prefix and just use prefixes for the rare case where you do have multi-language content. It's analogous to the domain prefixing used in this way: 'www' for the default language, 'www.du' for dutch, 'www.fr' for french, etc.
D6 currently sets this up automatically for English, but you're right that it would be more transparent not to allow this configuration at all.
Furthermore, I just realised a site depending on this behaviour can always use URL Rewriting to keep using non-prefixed URLs for its dominant language in future Drupal versions. So, yes, let's remove this complexity from core. :)
Comment #11
XanoWhat about this? If you haven't got path prefix negotiation enabled, the prefix isn't being used and therefore doesn't do anybody any harm. Ergo, there's no reason not to use prefixes.
Comment #12
GuyveR800 CreditAttribution: GuyveR800 commentedThat's right. The only reason to allow a blank prefix is for the 'dominant language' feature I described in #10 (in which case path prefix negotiation is set), but which can also be implemented by an admin with URL rewriting.
I found another issue that deals with this: #277681: Setting new default language makes English inaccessible
Comment #13
XanoIf #282178: Language negotiation overhaul gets committed we can fix this issue by simply requiring prefixes for all languages.
@GuyverR800: Please take a look at how others link to issues. A link to an issue with the URL as the link text is not very user friendly.
Comment #14
alexanderpas CreditAttribution: alexanderpas commented+1 for requiring prefix, and automatically removing the prefix afterwards if it is the sites default language!
@GuyverR800: we type this
[#
277681
]
to get this #277681: Setting new default language makes English inaccessible and it'll link to here http://drupal.org/node/277681 (note the emphasis on the number)Comment #15
GuyveR800 CreditAttribution: GuyveR800 commentedAh, I was already wondering how that worked! Thanks for the explanation :)
Of course, now that you mention it, I see it's also explained below the textbox :/
Comment #16
GuyveR800 CreditAttribution: GuyveR800 commenteddunno what happened there :S
I blame Firefox' form completion ^^;
Comment #17
catchThis is a really good idea, but it's a normal bug, not a critical task.
Comment #18
Gabriel R. CreditAttribution: Gabriel R. commentedMe too.
Comment #19
Anonymous (not verified) CreditAttribution: Anonymous commentedComment #20
plach@Dominic Mayers:
I didn't have time to give a look to the issue you linked yet, but you might want to test the new language negotiation system shipped with Drupal 7. It's pretty different from the D6 one. See #282191-59: TF #1: Allow different interface language for the same path for details.
Comment #21
Anonymous (not verified) CreditAttribution: Anonymous commentedComment #22
plachThis has not been considered after the language negotiation overhaul. I propose the following solution: making the path prefix mandatory in the language configuration form for all languages and add an option to the URL language provider configuration form to specify whether the path prefix should be used for the default language (default unchecked, to match the current behavior).
Comment #23
Anonymous (not verified) CreditAttribution: Anonymous commentedComment #24
plachThe attached patch should fix the non-default-language-with-empty-prefix issue by forcing a path prefix when changing the default language. Tests are updated accordingly.
Comment #25
dddave CreditAttribution: dddave commentedThis issue is an (almost) daily support request. Fixing this would be really nice and kill a WTF for noobs. Given the fact that building a multilingual site is not totally easy, this should really go into D7.
Comment #26
dddave CreditAttribution: dddave commented#24: language_path_prefixes-338055-24.patch queued for re-testing.
Comment #27
plachretitling
Comment #28
plachTrailing whitespace. Rerolled.
Powered by Dreditor.
Comment #29
plachwindows newlines...
Comment #30
GiorgosK#29 looks good
fills out empty non-default prefixes
and does not let them get empty !!!
Comment #31
webchickCan someone help me understand the behaviour change introduced by this patch? It's not clear from reading the posts above, which sounds like people are just generally confused. A final issue summary would be helpful.
Additionally, it seemed like a somewhat contentious change in 2008, so I'd like to see at least a few reviews before a RTBC.
Comment #32
GiorgosK@webchick
the reports are really all appearances of the same underlying problem
I believe its all summarized in #24 forcing a path prefix on non-default languages
there was a different proposal from @plach in #22 that was not implemented
its really not a big change (I believe it is RTBC)
Comment #33
plach@webchick:
The whole issue boils down to this: at the moment only default language is allowed to have an empty language prefix; but we have a subtle bug: one can change the default language from the language configuration page and the system does not check that the previous default language has a non-empty prefix. Since english language by default has no prefix, this almost always leads to having a broken configuration in which the default language has a language prefix and a non-default language has not. Needless to say that this messes up language negotiation and can be really hard for novice users to track down.
Moreover english not being prefixed by default has been argued as a non ideal design solution. Two years and half ago. When I started working on this we almost were in UI freeze, so my solution was: let's cut down this silly bug and leave design considerations for D8.
The solution provided by the patch has no impact on the UI, otherwise we could have found better ones: it simply forces a language prefix when changing default language and the previous default has an empty one.
Since the fix is pretty straightforward and has been reviewed and tested by GiorgiosK, I'm marking this RTBC again. Obviously if you still feel that additional reviews are needed, just change this back to needs review :)
Comment #34
webchickThanks, that helps a lot.
It makes sense to me, but yes, I would like to hear a reasoned +1 from at least one more person who has reviewed the patch in-depth, since this is a behaviour change from D6 being introduced very late. Since there were a lot of people in the middle of this post who were advocating for it, I'm hoping one of them can assist.
Comment #35
plach@webchick:
Let me only clarify that we are not changing the D6 behavior: English still has an empty prefix by default, we are simply automating a setting that atm an user is forced to perform manually, if she realizes she has to do it, to get a working configuration.
Comment #36
dddave CreditAttribution: dddave commentedBump to get the attention of somebody in position to address webchick's request in #34.
The patch works as advertised and it would kill a constant DrupalWTF.
Comment #37
alexanderpas CreditAttribution: alexanderpas commentedI reviewed it, and can conform it works as intended.
It automatically adds the default prefix for that language when there is no prefix set for the non-default language, which is required anyways to allow this language to work in the first place.
Previously, the user was required to set this manually, and if he didn't it caused the bugs seen previously in this issue.
The fix only kicks in when there is no language prefix set for an enabled non-default language (which previously caused the bugs), and doesn't influence the behaviour in any other way.
Comment #38
tom_o_t CreditAttribution: tom_o_t commented#29: language_path_prefixes-338055-29.patch queued for re-testing.
Comment #39
webchickCommitted to HEAD. Thanks!
Comment #41
LarsKramer CreditAttribution: LarsKramer commentedHi, I found a case where this is not working. Steps to reproduce:
However, adding a third language after installation, setting that to default and removing its prefix, will automatically give English the "en" prefix.
Some other thoughts regarding this: I think when installing Drupal in another language than English, that language should by default be the only language enabled, and have its prefix removed. Or alternatively, on the "Choose language" page during installation we could provide an option for enabling additional languages (English and any other language for which translation files exist). If this makes sense, I would submit it as a feature request for Drupal 8.
Comment #42
plachThis looks like a sensible idea to me: the D8MI might cover this but a feature request won't hurt.
Comment #43
mhamed CreditAttribution: mhamed commentedhello
i vve got drupal 7.8 now after all the updates from drupal 6.20
The default language is and was English but for many reasons I m trying to use Arabic as an other principle language I tried with the translations ;
Installed other languages that have something to do with Latin forms
But still the default was En
Downloaded the Arabic drupal .po imported it and make it as default
Whenever all urls now are .com/en/admin....
but no ar I went to config/language/edit/en
deleted the prefix en
but this changed to be .com/it/admin....
since Italian is enabled
disabled Italian language but the problem returned with :/en/
made English as default as it was with disabling italian and solved
i do not know a lot about this but these perhaps help
and hoping for a multi language site
thanks
Comment #44
dddave CreditAttribution: dddave commented@#43
Please read an respect: http://drupal.org/node/317
Your problem doesn't belong into the core queue. Instead you should post in the support forum: http://drupal.org/forum
Comment #45
_12345678912345678 CreditAttribution: _12345678912345678 commented#29: language_path_prefixes-338055-29.patch queued for re-testing.
Comment #47
_12345678912345678 CreditAttribution: _12345678912345678 commentedFailed when I re-tested it. :(
Comment #48
Gábor HojtsyThis is already what is happening.
We have an issue for multiple language selection in the installer but I cannot find that right now.
So the problem explained in #41 does not happen anymore. Moving to backport to Drupal 7.
Comment #54
poker10 CreditAttribution: poker10 at ActivIT s.r.o. commentedThe patch to D7 was commited 12 years ago by @webchick, so I do not see anything to backport here. Setting the status back to Fixed. If I have missed something, feel free to set the status back.