The Frontpage issue http://drupal.org/node/64412 has been given a status of fixed but perhaps prematurely.

The problem in that issue had two components:

  • The Mission Statement was not properly displayed in a multilanguage environment
  • Links referring back to the Front Page always landed in the default language regardless of the language one was in

The first problem is indeed fixed. AFAIK the second problem has not been solved.

My site is in english and german. When I am in german and I click on the "home" link or on the main logo the home page is displayed in english.

The second problem is also discussed here http://drupal.org/node/70547. Neither of these threads has a clear solution to the problem. The issue with breadcrumbs seems to be sort of a "cludge" and not a true fix. It also doesn't address the main logo link problem (or does it?).

Am I missing something? If someone knows of an elegant fix I'd be grateful.

Thanks

Comments

ap’s picture

Title: Links to the front page » I apologize

Perhaps I was a bit premature. The solution suggested in http://drupal.org/node/70547 does fix the problem. It seems to be a sensible solution and not a "cludge". But I'm still wondering if this is the 'official' solution to the problem. This change is not in the current CVS version.

ap’s picture

Title: I apologize » Very strange i18n behaviour

It works but only when it wants to. Strange!!!!!

I implemented the following changes as recommended in the above threads
- 'site_frontpage' in settings.php
- page.inc
- template.php

On my local test site it seemed to fix the problem immediately. Returning to the home page from a node retained the currently selected language. This worked from the breadcrumb as well as the logo.

My internet site seemed 'stubborn' but after playing around with many settings it worked ther as well.

I was just about to close this chapter and move on to something else, when I noticed that the problem was no longer fixed. The old behaviour was still active. Namely, from a german node returning to home page brought up the default english page. I have no idea why.

Now my test site is back to the old behaviour.

I have no idea what's going on. My hunch is that i18n is actually working with these changes but something in the menu system and or caching may be causing a problem.

It would be nice if someone could address this problem who has more knowledge of the overall arcitecture.

Thanks

Andy Potter

ap’s picture

Title: Very strange i18n behaviour » Very strange i18n behaviour - Follow up

Ok things are not as bad as it seems.

The Problem I had was that I was logged in to my Drupal site as a user. The i18n module forces the fornt page to revert to the preferred language of the current user even if another language has been chosen.

Suppose User-A has a preferred language of english but uses the language switcher to switch the site to german. The entire site will now be rendered for User-A in german, except for one exception. As soon as User-A returns to the page the language is switched back to english.

This makes some sense. The whole point of a preferred language is that the site adopts this language whnever the user logs in. However, it would be nice if the site would stay in a language, when a user requests it.

The problem is how do you distinguish between the following two cases:

  • The user comes to the drupal site from "outside", starting a new session but perhaps through cookies still logged in.
  • The user is browsing within a drupal site and clicks on a link to go back to the front page but intends to browse further.

My impression is that the current logic of i18n does not distinguish between these two cases and assumes that every visit to the front page requires tha language to be set as if it is a "first" visit.

A possible solution would be to override the preferred language setting of a user when the user uses the language switcher. This state would remain active as long as the user is logged in. Even when they are logged in over a long persiod of time through use of cookies. When the user logs out this setting would be set back to the preferred setting from the user configuration.

-------

Is anybody reading my posts???????????

davemybes’s picture

Yes, at least one person is reading your posts :)

After reading through your postings I thought to myself: "I setup a home link through the logo and it works perfectly, whats the big deal?". Then I went to see what I had done, and saw that in fact the link wasn't working correctly. After a bit of playing around, I have fixed it so that it always goes to the front page for the currently selected language. I didn't edit any modules or what have you. I simply edited the link in my page.tpl.php file. Here is my link:

<a href="<?php global $i18n_langpath,$base_url;print $base_url."/".$i18n_langpath; ?>"><img ..../ ></a>

I have set my default front page to "node" for both english and french. When using the home button on the menu, the english one goes to <front> and the french one goes to fr.

So far, I haven't noticed any other problems (except for one odd situation where, when a page's url alias was "sponsors", the flag for English would have a CSS style display:none added to it - change the alias to "sponsor", and the flag reappears).

If this doesn't help you, then at least you know someone else is reading your stuff :)

ap’s picture

Well it's good to know that I'm not talking with the wind. ;)

I've had a look at your solution and it does work. The thing I'm uncertain about is if it is conceptually the right place to make such a change. Does it fit with the overall architecture and concept of Drupal? Does a change like yours cause side-effects somewhere else? Do the changes I have made fix and/or create problems in other areas? I don't know. And I don't know enough about the entire system to make that decision.

The reason I was so concerned earliar is that I thought the strange behaviour was occuring for all users. Once I discovered that it behaves differently (i.e stays in one language) for anonymous users I was relieved.

I'm fairly satisfied with the i18n/translation module now. It took a little getting used to but It is now very useful and powerful. The problem I've brought up here, I would now classify as an unpleasant glitch. Most of the time a registered user will browse the site in their preferred language anyway and thus never come across the problem. I'm planning on leaving the code as it is. Maybe something will pop up in the future that requires a change. I'll just wait and see. In the mean time maybe the developer(s) can decide on which approach is best and include that in future releases of the module.

jose reyero’s picture

Status: Active » Closed (won't fix)

Hey, I'm also reading the issue queue :-)

(Btw, in this case the issue title didn't help too much so this issue was at the bottom of my queue...)

The theme workaround proposed here should work. All this has been fixed in v5. If someone feels like backporting the patch, please go ahead...