(I reported this issue originally at #221121: language preferences not automatically respected., where it didn't clearly belong, so creating a new issue:)

The description of language negotiation setting "None" on page admin/settings/language/configure seems confusing and leaves unclear, how the user's own language preference modifies the language of the site presentation.

The current wording is:

None. The default language is used for site presentation, though users may (optionally) select a preferred language on the My Account page. (User language preferences will be used for site e-mails, if available.)

Does this mean, that when active, the user's preferred language (user/%n/edit -> Language Settings -> Language) is used for e-mails, site presentation or both?

I was not able to determine exactly what the correct meaning is even by changing the setting and observing the results: all my test cases indicated that the user's language setting doesn't change (as it does on Drupal 5.x). Maybe this could be cleared up in the help/description text?

CommentFileSizeAuthor
#19 222401-language-none.patch577 bytesDamien Tournoud
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

keith.smith’s picture

Version: 6.0 » 7.x-dev
Component: language system » documentation
Category: bug » task

This is a spinoff, as noted, of portions of #6 through #11 of http://drupal.org/node/221121. In the other issue, I suggested that perhaps the text should be simplified to read:

None. The default language is used for site presentation. Users may (optionally) select a preferred language for site e-mails on the My Account page.

This will have to be fixed in HEAD, and then backported at Gabor's discretion, though doing so will break translations and I am doubtful that he will wish to do so.

Also, though I think this suggestion is arguably more clear, I don't think the original is unclear, so I'm not positive this is a bug, but instead, perhaps a task.

keith.smith’s picture

Component: documentation » user interface text
htalvitie’s picture

Title: Lang. negotiation settings: incorrect and/or confusing wording » Language configuration UI doesn't (really) have option "none" for language negotiation
Version: 7.x-dev » 6.0
Component: user interface text » language system
Category: task » bug

I still don't understand the logic behind the implementation of the site-wide language negotiation setting vs. user-specified language preference setting. In my opinion, the help text seems to indicate that the user has some option of enforcing a language for the interface, but according to keith, the language is limited only to site e-mails.

I'm trying to clear the confusion by looking at the code.

This is the language_initialize() function taken from language.inc. I have broken it in smaller blocks and provided my interpretation of the code:

/**
 *  Choose a language for the page, based on language negotiation settings.
 */
function language_initialize() {
  global $user;

  // Configured presentation language mode.
  $mode = variable_get('language_negotiation', LANGUAGE_NEGOTIATION_NONE);

This retrieves the language negotiation mode, which should be an integer from 0 to 3 corresponding to the four choices defined in bootstrap.inc.

In case no setting for this value was found, the default value of LANGUAGE_NEGOTIATION_NONE is used. This is the usual path, since the variable language_negotiation doesn't exist on a fresh Drupal 6 install.

  // Get a list of enabled languages.
  $languages = language_list('enabled');
  $languages = $languages[1];
  
  switch ($mode) {
    case LANGUAGE_NEGOTIATION_NONE:
      return language_default();

This case statement ends the execution of the function and returns the default language specified for the site. I see this as a very deterministic phase: now we have the language, nothing to do here anymore, so let's exit and use this language. And this is the part that will be executed always, when no negotiation setting has been set. (I'm starting to repeat myself...)

In the case some other negotiation mode is selected, the appropriate processing will be done:

    case LANGUAGE_NEGOTIATION_DOMAIN:
      foreach ($languages as $language) {
        $parts = parse_url($language->domain);
        if (!empty($parts['host']) && ($_SERVER['SERVER_NAME'] == $parts['host'])) {
          return $language;
        }
      }
      return language_default();

    case LANGUAGE_NEGOTIATION_PATH_DEFAULT:
    case LANGUAGE_NEGOTIATION_PATH:
      // $_GET['q'] might not be available at this time, because
      // path initialization runs after the language bootstrap phase.
      $args = isset($_GET['q']) ? explode('/', $_GET['q']) : array();
      $prefix = array_shift($args);
      // Search prefix within enabled languages.
      foreach ($languages as $language) {
        if (!empty($language->prefix) && $language->prefix == $prefix) {
          // Rebuild $GET['q'] with the language removed.
          $_GET['q'] = implode('/', $args);
          return $language;
        }
      }
      if ($mode == LANGUAGE_NEGOTIATION_PATH_DEFAULT) {
        // If we did not found the language by prefix, choose the default.
        return language_default();
      }
      break;
  }

Lot's of "returns $languages;", as if all cases would be covered?

Actually, no.

If none of the above conditions (yes, there are more of them!) is met, the function still continues with these lines:

  // User language.
  if ($user->uid && isset($languages[$user->language])) {
    return $languages[$user->language];
  }

  // Browser accept-language parsing.
  if ($language = language_from_browser()) {
    return $language;
  }

  // Fall back on the default if everything else fails.
  return language_default();
}

This was the interesting part, since I don't see when the execution is supposed to get to this last part:

  if ($user->uid && isset($languages[$user->language])) {
    return $languages[$user->language];
  }

I would really like that Drupal just execute this block. Now the whole function seems to be coded as if this section is not meant to be executed at all. Or is it? I don't know. It's confusing -- exactly like the help text for the setting.

By looking at the code, it looks like I am supposed to cheat by inserting any value NOT listed in the case blocks:

UPDATE variable SET value = 's:2:"-1";' WHERE name = 'language_negotiation';

To make it cleaner, I would create a new constant:

define('LANGUAGE_NEGOTIATION_REALLY_NONE', -1);

.. and make a proper case block in language_initialize() to handle this.

In my opinion, this should be classified as a bug, not a user interface text issue. And definitively not something to be pushed to 7.0.

isani’s picture

The behaviour of the "none" setting is also in conflict with the text at admin/settings/language, which states:

"If multiple languages are available and enabled ... registered users may select their preferred language ... The site's default language is used for anonymous visitors ..."

To me, this strongly implies that registered users can always select any enabled language and have the interface presented in that language. This is not the case with the "none" setting, which sets presentation to the default language only.

Like htalvitie, I don't really see why turning off language negotiation should also remove the user setting for presentation language.

Gábor Hojtsy’s picture

@isani: "none" lanuguage negotiation basically means "no interface language switching". It might have made more sense indeed to not provide any user setting for language in this case, which was the state of Drupal for quite some time. But then we realized that we need to support user language settings for some reason. I cannot recall the exact reason now, but this can be digged up. The quote you added only says that users might have the possibility (depending on other settings), although I am not good in "may", "might", "should", "shall", etc logic and fine grained differences of these.

htalvitie’s picture

@Gábor: I think the question should be reformatted as: "where is the setting to enable the user interface language selection?"

The original title of this issue came from the impression that any language negoation mode, including "None" (which can't be overrided, because it's the default if nothing else is set), disables interface language selection.

As far as I can tell (by testing it out and looking at the code), the only way to restore to user-specified selection logic is by modifying the value of the language_negotiation variable manually to anything other but the currently defined constants.

And with language interface switching I do no mean anything based on domain names, path prefixes, browser language settings etc. - just the simple functionality which is present in 5.x.

htalvitie’s picture

Version: 6.0 » 6.1
htalvitie’s picture

I haven't seen any reactions regarding the language selection issue (the implementation at code level) for nearly a month.

If my code analysis above could be confirmed (or alternatively, the mysterious coding logic explained) by others, then maybe somebody could start working on it. Now it's still unclear, if the code is faulty or not. As long as it's unclear, nothing happens.

Even a confirmation from a second reviewer of the issue would be welcome.

Tatsunami’s picture

I've just written support for a "User-Preference only" option of language negotiation into my development system, the changes were surprisingly short and simple. I can post them here if there's a need, and I'll try to roll them into a patch this week or next, depending if I meet my current deadline ;)

htalvitie’s picture

@Tatsunami: Great, looking forward to it!

I think there is a real need *soon* for a fix when multilanguage Drupal 6 sites start their deployments in mass. Currently most are probably still waiting for CCK/Views to finish, and users have not had the opportunity to notice the issue.

Tatsunami’s picture

I'll post them here for the moment, just because it's faster to copy & paste out of the project wiki than it is to learn the patch system and go through the approval process. I'm still pretty new to Drupal, so there might be plenty to clean up. It will be submitted as a patch soon, I'm just not sure when.

It should be noted that there is one bug that I'm aware of with the fix below: When the user changes their language-setting and clicks Save, the page reloads correctly using the new language, but the message confirming that the changes have been saved appears in the old language. I'm sure it's an easy fix, it just hasn't been my top priority yet.
Anyway, the steps are as follows:

  1. Edit includes/bootstrap.inc (line 133ish) to add a LANGUAGE_NEGOTIATION_USER variable (or whatever you'd like to call it).
    /**
    	 * User-preference based negotiation with fallback to default language
    	 * if no language is declared by the user.
    	 */
    	define('LANGUAGE_NEGOTIATION_USER', 4);
  2. Edit includes/language.inc (line 54ish, language_initialize()). Add a new case to the switch-statement which processes the case of the LANGUAGE_NEGOTIATION_USER variable.
    case LANGUAGE_NEGOTIATION_USER:
    	  	if ($user->uid && isset($languages[$user->language])) {
      		  return $languages[$user->language];
     		}
    		break;
            
  3. Edit includes/locale.inc (line 448ish, locale_languages_configure_form()). Add an element to the #options array to include a clickable option in the form for our new option.
    '#options' => array(
    		      LANGUAGE_NEGOTIATION_NONE => t('None.'),
    		      LANGUAGE_NEGOTIATION_PATH_DEFAULT => t('Path prefix only.'),
    		      LANGUAGE_NEGOTIATION_PATH => t('Path prefix with language fallback.'),
    		      LANGUAGE_NEGOTIATION_DOMAIN => t('Domain name only.'),
    			LANGUAGE_NEGOTIATION_USER => t('User preference only.')),
  4. Edit modules/locale/locale.module (line 55ish, locale_help()). Add the description for our option in the 'admin/settings/language' case. Note that you have to move the closing </ul> tag to the end of this new option, rather than its current location at the end of the 'Domain Name only' description above it.

    $output .='<li>' . t('<strong>User preference only.</strong> The preference set in the user\'s account is used for site presentation. If no preference is specified, the default language is used') . '</li></ul>';

Like I said, it's about 4 lines of code you have to add. If you have any questions, or anything is unclear, lemme know!

danghoaiphuc’s picture

Hi Tatsunami,
Thanks for a great patch. It works with user language option but I got the problem to set my Default language instead of English. I think this bug is due to Drupal 6.1. It says configuration saved but nothing saved. If not check English, it will automatically check English as the Default language.
In Drupal 5.x I see one data cell in the Local_Meta table in the database has the colunm "isdefault" but in Drupal 6 in Language table it's not. Looking forward to your help.
Dang

Arthur Yu@drupal.soa.tw’s picture

Hi danghoaiphuc ,

I got the same problem in my Chinese Traditional site,It may be occurred only in a cPanel created drupal site, but I'm not sure ,and not find a way to solve the problem.....

htalvitie’s picture

Version: 6.1 » 6.2

Still broken?

Damien Tournoud’s picture

Version: 6.2 » 6.x-dev

I can't see any bug in the code here. "None" means "1) use the user preference if set, 2) if it fails, use the browser preference, 3) if it fails, use the default language". This means that LANGUAGE_NEGOTIATION_USER above is *exactly the same* as LANGUAGE_NEGOTIATION_NONE.

The only defect is that the description of the "None" setting (and even its name), is somewhat confusing. Lets patch this, and close that issue.

htalvitie’s picture

@Damien: The manual patch described by Tatsunami at #11 has not been committed (or packaged and tested as a patch - as far as I know). The bug still remains in core.

Damien Tournoud’s picture

@htalvitie: I know, what I mean here is that there is no bug.

The only defect is a documentation issue (None should be called something else, for example "User defined").

htalvitie’s picture

@htalvitie: I know, what I mean here is that there is no bug.

Yes, there is. I have described it carefully (#3). Also, Tatsunami et al. have confimed it - and even proposed a patch based on my findings.

I can't see any bug in the code here. "None" means "1) use the user preference if set, 2) if it fails, use the browser preference, 3) if it fails, use the default language". This means that LANGUAGE_NEGOTIATION_USER above is *exactly the same* as LANGUAGE_NEGOTIATION_NONE.

No, "None" means:

case LANGUAGE_NEGOTIATION_NONE:
      return language_default();

And language_default() is defined as:

/**
 * Default language used on the site
 *
 * @param $property
 *   Optional property of the language object to return
 */
function language_default($property = NULL) {
  $language = variable_get('language_default', (object) array('language' => 'en', 'name' => 'English', 'native' => 'English', 'direction' => 0, 'enabled' => 1, 'plurals' => 0, 'formula' => '', 'domain' => '', 'prefix' => '', 'weight' => 0, 'javascript' => ''));
  return $property ? $language->$property : $language;

So, very simple: The user's language setting doesn't work, and only a site-wide configuration is used.

I call this a bug.

Damien Tournoud’s picture

FileSize
577 bytes

@htalvitie: You are right, sorry. I missed the LANGUAGE_NEGOTIATION_NONE case in your code above.

Here is a proper patch for this issue. It applies cleanly both to 7.x and 6.x, but because the bug is present in both branches, the patch should be first applied to 7.x then backported to 6.x.

Damien Tournoud’s picture

Version: 6.x-dev » 7.x-dev
Status: Active » Needs review
Damien Tournoud’s picture

s.Daniel’s picture

I just ran into this as I like to administer my German sites in English because there is more documentation available in English than in German. So while I missunderstood the describtion of "none" as well (probably because I often rather scan text than reading it and I might have skipped everything in the brackets) I don't think it is something that should only be fixed due to explaination.
For me, building a German site - not a multilingual - the way D5 worked was perfect. Set default Language to German and user language to English. Would this be the right place to ask for this or should I fill a seperate feature request?

alliax’s picture

Title: Code block never executes in language_initialize() » Language configuration UI doesn't (really) have option "none" for language negotiation
Version: 6.x-dev » 7.x-dev
Status: Closed (works as designed) » Needs review

No, here is the right place to ask for this.
I ran into the issue immediatly, as soon as Drupal 6.0 was out I created a multi install, so I want to create english (only) and french (only) websites easily, but manage them all in english like I was doing on a drupal 5 multi install.
But I was forced to bear with having all admin in french on the french sites, very confusing and useless.
And I've been creating issues on french forum and here without much success. Now I see this issue as the most researched and explained, so hopefully something will come out soon in drupal 6.3 to resolve this annoying bug!

Subscribing :-)
cafetiere expresso

s.Daniel’s picture

To show an example how important it is for foreign language speaking admins to know what the english term for a translated string is:
Guess what "Ansichten" means? No Idea? So was my impression. I searched for views module on my site and already thought something crashed as I couldn't find the damn module until I found out that in German translation "Views" is translated to "Ansichten" - Sure this is the right translation but now imagine you look in you site for "Views" and can't find it because someone renamed it to "opinions". Or you search in google for "opinions" because you think thats the modules name. Guess this leads to another discussion "Should modul names be translated?" or "Should Drupal specific terminologies be translated" which I don't want to discuss here.
Anyway I'd be happy if I could change my Language in my user profile without any other impact on my site.

Damien Tournoud’s picture

@s.Daniel: there is definitely a bug here. Drupal should allow user-selected languages, no doubt about that.

The patch in #19 should solve the problem. Could you try it and give us feedback?

s.Daniel’s picture

Successfully tested with 6.0 and 6.2

Test with http://drupal6-0.localhost

Default language German. User has Englisch as chosen Language.

None
> Site German
> English for my user
> en/ Page not found
> de/ Page not found

Path prefix only.
> Site German
> Site German for my user
> en/ Page not found
> de/ German

Path prefix with language fallback.
> Site German
> English for my user
> en/ Page not found
> de/ German

Domain name only.
> Site German
> German for my user
> en/ Page not found
> de/ Page not found

How about a seperate option "Overwrite settings by users choice" ?

Damien Tournoud’s picture

@s.Daniel: so after applying this patch you are seeing the documented behavior. Is that right?

If you feel that the documented behavior need to be changed, please open a separate feature request.

s.Daniel’s picture

Yes, this is the behaivior after appling the patch. So the patch works for me and the idea of a radiobutton "[ ] overwrite Interface language by users choice" was just a quick idea.

Gábor Hojtsy’s picture

#19 is far from a complete patch. Unfortunately you have not been around when this language system was designed, so you have not been able to provide your feedback. If we fall back on the user preference when "no language negotiation" is selected that does not only breaks the definition of "no negotiation", but also gets to different language content for the same URLs depending on user preferences, right?

The idea behind only switching languages based on path prefixes or domain names is to have different language content under different identifiable URLs. Also, the user preference clearly describes in case of "no negotiation" that the preferred language is only used for emails, so patch #19 is not complete in that it does not turn around the user setting descriptions additionally to the site setting descriptions.

htalvitie’s picture

@Gábor: I do not want to offend you, but I must confess your #29 was very cryptic and hard to decipher. Maybe you mean the same as I do, but (maybe because of my English-as-a-second-language handicap) I'm not sure.

Since I reported the issue originally, let me try to restate again what - in my opinion, and based on comments from others, is actually needed and what this whole thread is about:

The new "language negotiation" feature is not for everybody. It is something that should be considered an *additional* and *optional feature*, and it should not negate or remove the original (e.g. Drupal 5.x) functionality for a very simple user-configurable language switch. As it is implemented it Drupal 6.x, it unfortunately does so.

In another words: I (and possible many others site owners) do not wish to implement any kind of "language negotiation", where negotiation is defined as detecting path prefixes, domain name variations, browser language preferences etc. For many, it adds unnecessary complexity and processing overhead for content dispatching.

The negotiation functionality should thus be completely optional, and the web admin should be able to turn it off (as was understood by me to be achieved with the "Language Negotiaton -> None" option) and reverting to the Drupal 5.x behaviour.

Maybe there could be a new option called "Language Negotation" -> "Disabled", since "Language Negotation -> None" clearly means something different and must be left alone to maintain backwards compatibility?

Hope you got the idea! :)

ahwayakchih’s picture

  if ($user->uid && isset($languages[$user->language])) {
    return $languages[$user->language];
  }

I would really like that Drupal just execute this block.

Thanks for checking that. I also don't want negotiation, and just want to use user's preferences for language, so i just made very quick and dirty change by commenting out lines 22nd and 23rd (Drupal v6.2 - "case LANGUAGE_NEGOTIATION_NONE: return language_default();") of language.inc file.

rosedragon’s picture

Version: 7.x-dev » 6.3
Category: bug » support
Status: Needs review » Postponed (maintainer needs more info)

Hi,

I'm not fond of php so how and where to use 222401-language-none.patch patch?
I want English content to not showing when users/guests select 'Indonesian' language, and vice versa and the patch is for this, right?

regards,
Rose

Damien Tournoud’s picture

Version: 6.3 » 6.x-dev
Category: support » bug
Status: Postponed (maintainer needs more info) » Closed (works as designed)

As per Gábor comment in #29, this behavior is by design.

htalvitie’s picture

Title: Language configuration UI doesn't (really) have option "none" for language negotiation » Language negotation prohibits code execution in language_initialize()
Status: Closed (works as designed) » Postponed (maintainer needs more info)

#Damien: I don't see why the description by Gabor (#29) would make the bug (#3) go away.

I am reverting this bug report issue back to active, since the bug has not been fixed. Also, I am renaming it so it limits the non-technical argumentation and only focuses on the coding issue.

We might disagree on the design or interpretation of the current language negotiation logic, but this verbal argumentation does nothing for the erratic code.

A separate feature request issue might be better suited for this discussion on "should Drupal provide a language choice for the end-user or not".

Damien Tournoud’s picture

Title: Language negotation prohibits code execution in language_initialize() » Language configuration UI doesn't (really) have option "none" for language negotiation
Status: Postponed (maintainer needs more info) » Closed (works as designed)

The logic of the language negotiation changed between Drupal 5 and Drupal 6. In Drupal 5, each user could choose its language in its "my account" page.

In Drupal 6, there is language negotiation based on the path or the domain name. In the fallback mode (NONE), the user interface of the site is always in the default language, but the user can choose its preferred language *for email* in its account.

That's a design choice, and the code fully respect this choice. There is no bug here. Please open a new issue (a feature request) against Drupal 7 if you want to revert that choice.

htalvitie’s picture

Title: Language configuration UI doesn't (really) have option "none" for language negotiation » Code block never executes in language_initialize()
Status: Closed (works as designed) » Active

Damien, yes I understand that the code respects the design choice. I am not arguing against that - anymore. As I said, the design choice should be dealt with in a separate issue.

But there is still a coding error, which is very clearly described in #3. Please read, analyze, debug and confirm it yourself. If you don't have the necessary skills to do that, please don't change the status of the issue.

I really, really don't understand why a code flaw deserves the status "by design".

I am getting tired of repeating myself.

Damien Tournoud’s picture

Status: Active » Closed (works as designed)

Please read the help text for LANGUAGE_NEGOTIATION_PATH:

Path prefix with language fallback. The presentation language is determined by examining the path for a language code or other custom string that matches the path prefix (if any) specified for each language. If a suitable prefix is not identified, the display language is determined by the user's language preferences from the My Account page, or by the browser's language settings. If a presentation language cannot be determined, the default language is used.

Then, open your eyes and read the code in language_initialize(). Marvelous, this is exactly what the code does!

Closing that non-issue, again.

alliax’s picture

This by design is really shit, what if I want to have a site in french for the public but I want to see it myself in english? Why did the drupal team change that possibility? Choosing the language ONLY for email is plain stupid, why do that in drupal 6? You smoke too much drug!

I'm really unhappy that this BUG(yes!!) is not fixed in drupal 6.3...

wpanssi’s picture

What do I have to do (ugly fixes, anything!) to make the user able to select the language in which he wants to see the site (just like in Drupal 5) while the default language remains something else?

I'm trying to read this thread but can't figure it out..
And in my opinion this new system is CONFUSING and doesn't really do what I think everybody wants..

Thanks in advance!

Damien Tournoud’s picture

@alliax, wpanssi: please open an other issue for those, this one is closed.

htalvitie’s picture

Damien: Yes, the part in language_initialize() which handles the language negotiation etc. is ok. This is not the issue anymore.

As I wrote just earlier, there is a non-disputable programming error in language_initialize(): a block of orphaned PHP code which doesn't execute. All the possible code paths are executed, so the flow of execution makes it impossible to proceed to the last part in the function.

How do you define a bug to be something "by design"?

I am asking this as a programmer, who has debugged the code and presented the evidence in #3. Nobody has argued with my findings, but still you insist on closing the issue.

Or should I also open a new issue and just copy-paste #3 there? Seems silly.

alliax’s picture

I've created another issue, but I came to this one because someone directed me here (from one issue I opened before)
http://drupal.org/node/282178

I'm not happy with what one user Damien is doing, don't you understand that everyone wants the old behaviour back?? Give me one person except yourself who agree that for a user selecting his prefered language and nothing happening is defined as normal?

Damien Tournoud’s picture

@htalvitie: as I tried to explain to you in #37, there is no dead code in language_initialize().

The last part of the function, beginning at:

  // User language.
  if ($user->uid && isset($languages[$user->language])) {
    return $languages[$user->language];
  }

is executed when $mode == LANGUAGE_NEGOTIATION_PATH and $prefix is not found in any of the $language->prefix, as stated in the description:

If a suitable prefix is not identified, the display language is determined by the user's language preferences from the My Account page, or by the browser's language settings. If a presentation language cannot be determined, the default language is used.

You are wrong in #3, and this issue is closed. Period.

htalvitie’s picture

Priority: Normal » Critical
Status: Closed (works as designed) » Active

In addition to my last comment:

The orphaned code block in language_initialize() actually implements the requested logic, where the user can actually make a choice of the language used for displaying the UI strings.

So the code is there, but the new language negotation switch prevents it from executing.

I am not sure, what conclusion should be made based on this. There are at least two ways to see it:

1) When planning the internationalization improvements for Drupal 6, a design choice was made to prevent the end-user from choosing the language for UI strings.

2) When the language negotiation was added in Drupal 6, the old user-optionality was supposed to work, but since nobody found the bug before RTM, and because the documentation now dictates how things work, this feature has been disabled.

In either case, the code should be fixed.

As for the design choice and implications thereof:

If somebody asks me, "Can the user choose the language for the user interface in Drupal 6", should I answer "yes" or "no"? In Drupal 5 the answer is yes.

I many countries, like here in Finland, there are several official languages. I was planning on providing my users the option of choosing either Finnish or Swedish as the UI language, and thought that the language selection box on the user's profile page would allow exactly that. But I can't.

Could somebody who has been in charge of this design choice, tell me and others, how on earth are we supposed to build multi-language sites without using the language negitation systems, since it is not suitable for many.

Domain or path prefixes mess up the site, makes it impossible to use permanent links, most users don't know how to use the browser's language options and even those who do, often want to make the language selection on the site anyway.

I think the design choice is a very bad one, and it could be fixed using a very simple patch. I don't understand what harm is done by allowing similar language option in Drupal 6 that works very well in Drupal 5. The new language negotation can co-exist quite nicely with the old logic.

Since this problem has been acknowledged by many, disables a needed feature and includes a regression bug, I am raising the status to critical.

Damien Tournoud’s picture

Priority: Critical » Normal
Status: Active » Closed (works as designed)

@htalvitie: can you even read? This issue is closed, the behavior is by design. Please open a feature request if you want the behavior to be changed.

htalvitie’s picture

Ok, I will create a duplicate issue if that is the way thist must be processed.

I am not, however, creating a issue discussing the design choice but the programming error, which is the basis for this issue.

If you insist on "bug == by design", then be it.

Damien Tournoud’s picture

God, can you read? There is no programming error here.

htalvitie’s picture

I have now created two separate issues, which together cover this one but allow for separate threads regarding the programming bug vs. design choice:

- #282191: TF #1: Allow different interface language for the same path
- #282189: Code never executes in language_initialize(), creates ambiguity regarding design choice of language logic

s.Daniel’s picture

@Damien: You refer to Gábor Hojtsy in #29 when you argue that this is "by design". Might be my bad English but as far as I can read Gábor does not say "This is how we made it and it is right because we chose it to be like that so shut up all you small people" like you seem to do. In fact what I read is more like "This patch is not good enough yet. This is how we though it should work and why."

If a feature people are actively using is suddenly gone - what is it if not a bug?
If someone took the Enter key from your keyboard and told you every time you want to press the key you need to send a text message to +1337 with the text "enter" in it cause he thought thats how it should work ... wouldn't you say that this is rather a bug than a feature?

htalvitie’s picture

I stand corrected, but there is still a problem here:

Since adding a new language often (if not always?) adds a prefix to the language table, this also creates a separate namespace for the pages than are generated to a user who selects a different language.

Why should I have to make the user-specific language option alter the page naming structure now, when in Drupal 5 this was not necessary?

I insist this is a bad design choice, and a simple solution which doesn't involve the language-negotiation overhead should be available as on option.

Gábor Hojtsy’s picture

htalvitie:

If somebody asks me, "Can the user choose the language for the user
interface in Drupal 6", should I answer "yes" or "no"? In Drupal 5 the
answer is yes.

The answer is yes, as Damien et al presented with both code and help text.

I many countries, like here in Finland, there are several official
languages. I was planning on providing my users the option of choosing
either Finnish or Swedish as the UI language, and thought that the
language selection box on the user's profile page would allow exactly
that. But I can't.

The effect of the language choice of users depends on the negotiation mode used, and is explained in the help texts.

Could somebody who has been in charge of this design choice, tell me
and others, how on earth are we supposed to build multi-language sites
without using the language negitation systems, since it is not suitable
for many.

Worst case is that you need to use a module like i18n was for Drupal 5, which set the language code using early running hooks (and you can turn off the negotiation system by setting it to option 'none' as explained in the docs).

Domain or path prefixes mess up the site, makes it impossible to use
permanent links, most users don't know how to use the browser's language
options and even those who do, often want to make the language selection
on the site anyway.

Ha, permalinks. Good point. So the design behind not changing language codes on the fly for the same URL is exactly permalinks.

  1. Assume Joe uses French and sees http://example.com/ and Jane uses Japanese and sees http://example.com/.
  2. Now their bookmarks (permalinks?) point to different interface languages, and possibly even different content, BUT the same URL.
  3. Now assume they see and permalink http://example.com/fr and http://example.com/jp
  4. Now they both can send these links over to whoever and those who get their links can see the exact language/content they see (this is what's called a permalink as far as I know, otherwise it is not permanent).
  5. Also, they can switch to whatever other language since those have different URLs.
  6. Also, Google/Yahoo/Live.com indexes their site/content in different languages, so their site/content will show up for both French and Japanese searches which is better audience coverage.
  7. It also eliminates the user setting in some cases, since users can just bookmark the different language version and browse from there (Drupal caches per language, so the anonymous caches will work nicely).

If you hide all the different languages behind the same URL, then it is not only hidden from users, it is also hidden from search engines, and is not possible to permalink. We had bad design choices in Drupal 5, and we were trying to correct these with the new features in Drupal 6.

Note that it is still possible to use the "bad design choice fallback" with the path prefix negotiation falling back to user settings, since we forgot to add a redirection to the user settings based language selection, so that works as it did in Drupal 5. But at the same time, it also corrects the hidden languages design flaw in Drupal 5 and allows access to different languages, based on different paths. It does not break existing URLs, since it allows access to the languageless URLs with exactly the Drupal 5 behavior you are looking for. Ideally, that user setting based selection should redirect the user to /fr for French, /jp for Japanese, etc, so that the "different language/content for the same URL" design flaw in Drupal 5 would have been completely corrected. Unfortunately we did not manage to do it all, so you have the option where language settings work as in Drupal 5.

wpanssi’s picture

I applied the patch presented in #19. But this patch creates problems when using global redirect. The issue is documented here: http://drupal.org/node/216271#comment-1082506

Any help appreciated!

s.Daniel’s picture

I don't think it is a problem with global redirect in particular rather I believe after applying the patch the alias languages are being chosen by the user accounts language rather than the content (or default) language which leads to content of language A havin aliases of language B.

pvasili’s picture

Only for registered users I want to see interface translated into language they have been selected.
I don't want to use prefixes.
It's really important to keep my old URLs because of search engines which already has indexed them and other site put links to some pages on my site.

URL "/node/12" now becomes "/fr/node/12"
I want to see only interface changings but not a URL's. But you are changing structure of my site :(

What should I do?

alliax’s picture

There's a patch somewhere to apply, this one http://drupal.org/node/335699 and perhaps another one I don't remember where, I haven't applied those patches, that's the only solution because obviously this is never going to be fixed because so many developers say that this is not a bug but just a feature from D5 which has been removed in D6 and may or may not be put back again in D7.
Perhaps it will be backported to D6, but I wouldn't count on that.
I call it a bug because it is stupid behavior to remove such a normal feature, maybe not a bug in drupal code but in the head of developers!

s.Daniel’s picture

Take a look at http://drupal.org/node/282191 for the technical discussion how this could be fixed in futur versions of Drupal.
For D6 I don't believe that we will see this behaivour outside of a patch or contrib module.

pvasili’s picture

I hope that this error will be corrected. (Totalizator ;) )

Yann’s picture

Putting aside the whole "design decision vs. bug" thing, anyone knows if the patch at #19 is safe/reliable to use on 6.8? Thanks!

pvasili’s picture

(#19) 2 Damien Tournoud - I have a problem in this patch...
Everything works fine, but when I save new node I see in the table "node" (column:language) my default language prefix (eg. En) :(

(#36) +100 - I agree with you that this is a critical error!

timmillwood’s picture

I have what looks like a similar issue on Drupal 5 site.

If a user changes their language in their profile they have to log out and back in for this to take effect.

Anyone planning a patch for D5?

advseb’s picture

It is unbelievable that this didn't get fixed. For us building a commercial multi-language page, it is about 5 times the effort for enabling multiple languages. We now have to go for a customisation to core. This bug is a very good example where developers are not able to recognise they made a mistake while designing a solution.

Kevin P Davison’s picture

I need the i18n "Domain name only" option to INCLUDE "with language fallback." Anyone willing to help $$, as well as help apply the patch to make this whole system work?

Drupal 6.14 and i18n...

Thanks!

yngens’s picture

Is a patch in #19 still applicable? Does it preserve the same URLs for the interfaces of different languages?

Drake’s picture

Title: Language configuration UI doesn't (really) have option "none" for language negotiation » Code block never executes in language_initialize()
Version: 7.x-dev » 6.x-dev
Status: Needs review » Closed (works as designed)

subscribe