Download & Extend

Logged out after selecting a language

Project:Google Translate
Version:4.7.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:owahab
Status:closed (works as designed)

Issue Summary

When I am logged into my site every thing is in English as normal, but once I select a translation I am logged out.
I can see the translation after I am kicked out, but logging in displays English again. I suspect this has something to do with the session variable, but am not sure.
I currently have several other modules installed including OG.

I am not getting any errors in php or when tailing the log file

Comments

#1

Assigned to:Anonymous» owahab

#2

Status:active» closed (works as designed)

regx: the problem is simply because the module requests Google to translate the page via GET, i.e. the module doesn't send the page's HTML to Google to translate but it requests Google's translate service and masks the output to show the Drupal site's URL.

In short: Google translates the page as anonymous thus it kicks you out sometimes.
I will change the way the module works to implement some new features and this will be one of them.

#3

Omar: I think it is possible to fix these problems.

First of all, you should create a database table. For example "gtrans_auxdata".
This table must have:

transid as varchar(64)
data as MEDIUMTEXT

Then, when a user request a translated page, you should do:

Get HTML for non-traslated page. Calculate MD5/SHA1 & use it as "transid". (You can also use auto_increment or similar).
Store the HTML data in the data field.

Query to Google for translating a Site URL like this: http://sitedrupal.org?transid=a40531af4

When you detect the query for transid, search the database, read the data, and exit.

By this way, you can navigate in other languages, even if you're registered.

NOTE: The cookies must be handled with the user, not with google.
NOTE2: You must use ob_start() method, or similar, to capture all the data. ¿Is this possible without patching index.php?

#4

Hi,

I had similar problem and i think they are either related to issue http://drupal.org/node/145203 or using different skin for the logged in user and the system default. To solve it i did two things:

1. Kept the skin/ theme of my site same as the site default.

2. Disabled the cache in admin/settings/performance

Hope this will help. If not then add a line

ini_set('session.cookie_domain', '.your-site-name.com');

in your sites/default/settings.php page.

In response to deavidsedice post, i think if you create a cache of site in database then it may create problem specially when some pages have restricted access to different roles of users. And if some page contents are dynamic. So in my opinion it should not be cached atleast for logged in users.

--rafi