I've just installed localizer on a new installation of drupal 5.7. But I found that after I swich language from front page, it always returns a page not found error or run into a 302 infinite redirect loop. Please see the scenario below and see if it helps.
$_GET['q'] = 'zh-hans' (I clicked Chinese, Simplified on the language block from the url http://127.0.0.1/, front page is set to node/1 with a path alias home.

In line 952 of localizer.module, there's a typo:

    return (localizer_get_localize_dpath($_GET['q'], $language) == $front);

it should be localizer_get_localized_path.

In line 802 of localizer.module, I think in your logic, it should be localizer_is_front_page, cause obviously the url http://127.0.0.1/zh-hans is not a front page url if you are using drupal_is_front_page.

    if (variable_get('localizer_frontpage_redirect', TRUE) && localizer_is_front_page()) {

In line 822, I think it should be $_GET['q'], that 'q' is set by drupal but not input by url, so $_REQUEST['q'] is null.

        $language_page = localizer_language_in_path($_REQUEST['q']);

In line 826, there's a line of code causes infinite loop

          if($session_support) {

it should be if(!$session_support) {

Comments

Roberto Gerola’s picture

Status: Active » Fixed

Thanks.
The fixes you suggested have been committed to the cvs repository

andyhu’s picture

Status: Fixed » Active

Sorry, I think in line 826, my code doesn't work either. When I cleared cookie (which means $_SESSION['current_locale'] is cleared), it runs into infinite redirect again, cause $_SESSION['current_locale'] is not set.

Do you know where the system sets $_SESSION['current_locale']? How does 'detect browser's language' working?

Thanks

mikl’s picture

Status: Active » Fixed

You should probably tag 3.1 with these changes like _really_ soon. I just walked into a ton of trouble by thinking "3.0 - ah, finally. I'll just go ahead and update this clients website"...

mikl’s picture

Status: Fixed » Active

Ooops, race condition.

Roberto Gerola’s picture

>You should probably tag 3.1 with these changes like _really_ soon.
>I just walked into a ton of trouble by thinking "3.0 - ah, finally. I'll just go ahead and update this clients website"...

After countless hours of works, and a great effort put on this project, and considering that you didn't
contribute in any form to the project, this type of comments is exactly
what is necessary to convince me to abandon this project.

Thanks.

Roberto Gerola’s picture

Version: 5.x-3.0 » 5.x-3.x-dev
Assigned: Unassigned » Roberto Gerola
Status: Active » Fixed

Committed to CVS some fixes to solve this issue.

andyhu’s picture

>After countless hours of works, and a great effort put on this project, and considering that you didn't
>contribute in any form to the project, this type of comments is exactly
>what is necessary to convince me to abandon this project.

Don't know if it's the right place to make comment but we are really appreciate your work on this project, it's a great module. Please don't abandon it, if you need any help (testing, code developing) I'm willing to contribute, I'm a full time drupal developer.

Thanks

Anonymous’s picture

Status: Fixed » Closed (fixed)

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