Drupal should allow a site designer to design an URL in terms of what he feels the users should see. The search engines are special non logged users and are not excluded from the issue that is raised here. I will give an example of a design that Drupal does not seem to easily allow. Whether it is a good design is irrelevant. Drupal should be a flexible tool to allow any kind of design. So, I will keep my example simple. The designer wants a multilingual site, but without any information whatsoever about language in the URL (say, only for logged users if you worry about SEO, but, again, it is beside the point). If a user choose, for example the French language in the language switcher block, the user interface and the content (as long as the translation is available) should be in French, but the URL should not contain a prefix "/fr" or a parameter &lang=fr, etc, nothing about the language. If he chooses the Deutsch language, then the UI, etc. should be in Deutch, but the URL should still have no information about the language. This is just an example. The general issue is that it seems that there is a basic design in Drupal that forces developers to use the URL for internal management in a way that may conflict with the expectations of a site designer. In this example, one might argue that the language in the URL is not internal management, but I disagree: it is not for us to decide what should be hidden or visible.

Comments

damien tournoud’s picture

Status: Active » Postponed (maintainer needs more info)

Please first try and understand the new language negotiation system in Drupal 7. This feature request and your reply to plach in [#2775092-174] seems to demonstrate that you failed to understand it.

sun’s picture

Version: 7.x-dev » 8.x-dev
  1. If nothing in the URL contains a pointer to the language, how do you determine the language to be used?
  2. As mentioned elsewhere, the new language negotiation basically allows any kind of weird setup, including setups like what you suggest (without any pointer in the entire URL), but such setups will obviously not work.

For me, this issue won't fix, but perhaps I'm missing something.

Anonymous’s picture

Category: support » feature
Anonymous’s picture

damien tournoud’s picture

Version: 8.x-dev » 7.x-dev
Category: feature » support
Status: Postponed (maintainer needs more info) » Active

Are you saying that I am mistaken and that, in the case of the above example, we can use the API of language negotiation to override the behavior of the switcher block so that it does not send the information in the URL?

The language negotiation API is made of three parts:

  • 'language': How to determine the language value of a given context.
  • 'switcher': How to generate a language switch link for a given language provider.
  • 'url_rewrite': How to rewrite outbound URLs to pass the language information, if necessary.

The 'URL' language negotiation provider, which uses the URLs (prefix or domain) to pass on the language information implements all of them. But the 'Session' language negotiation provider, which stores the language of a user in the session, only implements 'language' and 'switcher', and does not add anything to the URL.

Seems that you are all set here.

Anonymous’s picture

Category: feature » support
damien tournoud’s picture

Please re-read and understand #5. 'url_rewrite' is optional, and it is not used for example by the 'Session' language negotiation provider.

Anonymous’s picture

Anonymous’s picture

Version: 7.x-dev » 8.x-dev
tstoeckler’s picture

Version: 7.x-dev » 8.x-dev

I'm not quite sure of your use case, Dominic, but I kind of found the idea interesting nonetheless. So I went ahead and tried it out on a D7 test site. And, as Damien said, it works fine. If you go the language settings screen there is a tab where you can choose how you want Drupal to find out about the language. And you can only enable 'Session' if you want. Then, of course, it's your job to get that information into the session, but that shouldn't be too hard. You just need a Language switcher block which writes the appropriate value in the session depending on which link you click.

Anonymous’s picture

Anonymous’s picture

Version: 8.x-dev » 7.x-dev
plach’s picture

Version: 8.x-dev » 7.x-dev

Just a side note: the Session language provider implements the language switcher callback and uses an URL parameter to change the language stored in the session. If the user is logged in, after the language switch the language parameter does not appear in the URL anymore (unless language is changed again), instead if the user is anonymous the language parameter is always used to ensure different page contents have different URLs.

tstoeckler’s picture

You just need to write a custom module to do that. Covering all of core to be completely '?' free in URLs is quite a task. (Do you also dislike '#'? If so, have you ever turned on overlay module? :) ) A forum topic or something is probably more appropriate than a core support request. Or, if you have a CVS account, open up a new project (if you are going to turn it into a proper module !!!). Because the general lack of interest in this functionality, which I derived from all the various responses to your comments, I would say that something like this has to actually exist and work in contrib before it is even considered to be put in core. Properly working this out in contrib would also reveal where certain APIs are inflexible, etc. and what potentially needs to be done in core to support this in contrib.

Anonymous’s picture

plach’s picture

@Dominic Mayers:

Yes, you described the current behavior correctly.

kewlguy’s picture

subscribing - kinda curious

Myself I am dealing with language setup by setting my default language to whatever I want for the site to be.

Then using tokens, without the language token, in the url aliases to make both my default language have the exact same tokens as my language neutral.

Then, I add the language token to the site urls for the non-default languages.

Seems to be working for me the default language and the language neutral both do not have a language prefix in the url and this looks cleaner to me, though, I am still working on figuring the i18n and l10n and languages out.

I'll post back when I have clearer results if anyone would like.

Anonymous’s picture

Anonymous’s picture

Category: support » task
Priority: Normal » Minor
Status: Active » Closed (fixed)
Anonymous’s picture

Title: More control on the URL » No title
Version: 7.x-dev » 4.0.0
Anonymous’s picture

Project: Drupal core » Annotation
Version: 4.0.0 » 4.2.x-1.x-dev
Component: other » Miscellaneous
WorldFallz’s picture

Title: No title » More control on the URL