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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

GuyveR800’s picture

Status: Active » Postponed (maintainer needs more info)

Giving 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.

hovel’s picture

Giving English a path prefix solves the problem, doesn't it?

Yes it does.

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.

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.

Personally I strongly believe path prefixes or other URL mechanisms are not the way to go, but that is another matter entirely.

I think i can agree with you.

Thanks for you reply.

GuyveR800’s picture

Title: Language selection conflict » Need warning for non-default language without prefix
Version: 6.6 » 7.x-dev
Category: bug » task
Status: Postponed (maintainer needs more info) » Active

At 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."

Xano’s picture

I 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.

Xano’s picture

Of course, prefix fields need to be required.

GuyveR800’s picture

Indeed 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.

Xano’s picture

Yes, 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.

GuyveR800’s picture

You 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).

Xano’s picture

Why 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.

GuyveR800’s picture

I'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. :)

Xano’s picture

It doesn't do anybody any harm if it's there, but not being used.

What 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.

GuyveR800’s picture

Title: Require path prefixes for all languages » Need warning for non-default language without prefix
Priority: Critical » Normal

That'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

Xano’s picture

Title: Need warning for non-default language without prefix » Require path prefixes for all languages
Priority: Normal » Critical

If #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.

alexanderpas’s picture

+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)

GuyveR800’s picture

Title: Require path prefixes for all languages » Need warning for non-default language without prefix
Priority: Critical » Normal

Ah, 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 :/

GuyveR800’s picture

Title: Need warning for non-default language without prefix » Require path prefixes for all languages
Priority: Normal » Critical

dunno what happened there :S
I blame Firefox' form completion ^^;

catch’s picture

Title: Need warning for non-default language without prefix » Require path prefixes for all languages
Category: task » bug

This is a really good idea, but it's a normal bug, not a critical task.

Gabriel R.’s picture

Me too.

Anonymous’s picture

plach’s picture

@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.

Anonymous’s picture

plach’s picture

This 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).

Anonymous’s picture

plach’s picture

Status: Active » Needs review
FileSize
3.57 KB

The 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.

dddave’s picture

This 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.

dddave’s picture

plach’s picture

Title: Require path prefixes for all languages » Ensure non-default languages always have a path prefix

retitling

plach’s picture

+++ modules/locale/locale.admin.inc	23 Jun 2010 00:08:07 -0000
@@ -107,6 +109,16 @@ function locale_languages_overview_form_
+    // assign a valid prefix to each non-default language. ¶

Trailing whitespace. Rerolled.

Powered by Dreditor.

plach’s picture

windows newlines...

GiorgosK’s picture

Status: Needs review » Reviewed & tested by the community

#29 looks good
fills out empty non-default prefixes
and does not let them get empty !!!

webchick’s picture

Status: Reviewed & tested by the community » Needs review

Can 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.

GiorgosK’s picture

@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)

plach’s picture

Status: Needs review » Reviewed & tested by the community

@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 :)

webchick’s picture

Status: Reviewed & tested by the community » Needs review

Thanks, 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.

plach’s picture

@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.

dddave’s picture

Issue tags: +DrupalWTF

Bump 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.

alexanderpas’s picture

Status: Needs review » Reviewed & tested by the community

I 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.

tom_o_t’s picture

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed to HEAD. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

LarsKramer’s picture

Status: Closed (fixed) » Active

Hi, I found a case where this is not working. Steps to reproduce:

  1. During Drupal install process, choose another language as default, for example Danish.
  2. After installation is completed, go to "admin/config/regional/language".
  3. You will notice both languages are enabled, and Danish is correctly set to default.
  4. Edit Danish, and remove prefix, save.
  5. Edit English, and you will see the prefix has not added automatically. Clicking save (without doing any changes) will however trigger the error message: "Only the default language can have both the domain and prefix empty."

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.

plach’s picture

Version: 7.x-dev » 8.x-dev
Issue tags: +Needs backport to D7

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.

This looks like a sensible idea to me: the D8MI might cover this but a feature request won't hurt.

mhamed’s picture

Version: 8.x-dev » 7.8
Assigned: Unassigned » mhamed
Category: bug » support

hello
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

dddave’s picture

Version: 7.8 » 8.x-dev
Assigned: mhamed » Unassigned
Category: support » bug

@#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

_12345678912345678’s picture

Status: Active » Needs review
Issue tags: -DrupalWTF, -Needs backport to D7

Status: Needs review » Needs work
Issue tags: +DrupalWTF, +Needs backport to D7

The last submitted patch, language_path_prefixes-338055-29.patch, failed testing.

_12345678912345678’s picture

Failed when I re-tested it. :(

Gábor Hojtsy’s picture

Version: 8.0.x-dev » 7.x-dev
Issue summary: View changes
Status: Needs work » Patch (to be ported)
Issue tags: -Needs backport to D7

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.

This is already what is happening.

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.

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.

  • webchick committed a730019 on 8.3.x
    #338055 by plach: Fixed Ensure non-default languages always have a path...

  • webchick committed a730019 on 8.3.x
    #338055 by plach: Fixed Ensure non-default languages always have a path...

  • webchick committed a730019 on 8.4.x
    #338055 by plach: Fixed Ensure non-default languages always have a path...

  • webchick committed a730019 on 8.4.x
    #338055 by plach: Fixed Ensure non-default languages always have a path...

  • webchick committed a730019 on 9.1.x
    #338055 by plach: Fixed Ensure non-default languages always have a path...
poker10’s picture

Status: Patch (to be ported) » Fixed

The 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.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.