Unwanted Language Switch for Annonymous users (Gallery 2 integrated to Drupal)

Aurelio

Joined: 2006-02-27
Posts: 7
Posted: Sun, 2006-03-05 19:11

This problem seems to be not of Gallery 2 alone, but of its integration to Drupal setting.
I have Gallery 2 (V 2.0.2) integrated to Drupal (V 4.6.5).

Problem is as follows: Gallery is by default set to local language Slovak.
Alone it works perfectly. Annonymous or Authenticated get this local language as default.
Drupal is set to the same language by deafault and it works OK too. But when annonymous user in
Drupal go to Gallery, Gallery surprisingly displays in English while Drupal part stays local.
If any user log in (to drupal) then language is OK, as set local Slovak, but from some
reason this does not work for annonymous users.

You can see:
http://www.foxy.sk/newfoxy
try to go "Galéria FOXY" as annonymous - you see that Gallery is running in English (date, owner
random image...).
Then you log in (Prihlásenie) as (user: gallery / passw: gallery) and see now. Gallery is in locale as it should be.
(maybe cache will need to be deleted or browser refreshed).

Interesting is that when I created that new user (Gallery), also for that user it worked like for
annonymous for the first login. Then I saw its account setting, local lang. was set as default as
expected (englis as optional). All I had to do was to save settings. Then language for this user
started to work. If account setting was not saved then It would work same wrong
way for this user just like it does for annonymous.

To me it seems that some code that justifies language setting in Gallery does not normally
run when galery is accessed from Drupal in integration. When accessed as alone, then this
problem does not exist.

Can you help me to set it up to override this problem please.

Aurel

The following information is required to get an answer:
Get this information from the PHP diagnostic (in the configuration wizard).
Gallery URL (optional but very useful): http://www.foxy.sk/newfoxy/gallery
Gallery version: 2.0.2 core 1.0.0.2
Apache version:
PHP version (don't just say PHP 4, please): 4.4.2 apache2handler
Graphics Toolkit: Thumbnail, Gd
Operating system: FreeBSD dw11.nameserver.sk 5.4-STABLE
Web browser/version (if applicable): Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)

 
Tim_j
Tim_j's picture

Joined: 2002-08-15
Posts: 6818
Posted: Sun, 2006-03-05 19:23

Moved to G2 forum.

Jens
--
Last Gallery v1 developer and translation manager.

 
Aurelio

Joined: 2006-02-27
Posts: 7
Posted: Sun, 2006-03-05 20:22

hellow again,

seems I found the clue.

I have followed: http://drupal.org/node/32072

and according to instruction modified file gallery.module in drupal/modules as follows:

replaced this old code:

$params = array('embedUri' => $embedUri,
'embedPath' => $embedPath,
'relativeG2Path' => $relativeG2Path,
'loginRedirect' => url('user/login'),
'activeUserId' => $user->uid,
'activeLanguage' => $user->language,
'fullInit' => $full);

with this modified:

$params = array('embedUri' => $embedUri,
'embedPath' => $embedPath,
'relativeG2Path' => $relativeG2Path,
'loginRedirect' => url('user/login'),
'activeUserId' => $user->uid,
'activeLanguage' => $lang,
'fullInit' => $full);
$result = db_query('SELECT locale, name FROM {locales_meta} WHERE isdefault = 1'); //get drupal's default language
$row = db_fetch_object($result);
$lang = $row->locale;

and seems it works OK now. Tested very quicky on PC only yet, will try to apply on my web later.