I enabled the i18n module in Drupal, and I have 2 URL for 2 languages. One is http://localhost/drupal/en/, another is http://localhost/drupal/zh-hant/.

When I visit the gallery page (http://localhost/drupal/gallery), Drupal changes the URL to http://localhost/drupal/en/gallery?g2_view=core.ShowItem&g2_itemId=7, and when I switch (use language switch block) to another language, the URL is changed to http://localhost/drupal/zh-hant/gallery?g2_view=core.ShowItem&g2_itemId=7

Although the URL is little strange (not a clean URL), it still works, both the interface of Drupal and embedded Gallery2 use the same language. But I found a problem, if the user is NOT login, everything is ok. But if user is login (admin), then when the language is changed, only Drupal's interface is changed, but Gallery still uses its default language.

btw, the "language selector" of the navigation bar in Gallery2 doesn't work too. I think it's not very important, since the Gallery is embedded in Drupal, we should use the language switcher of Drupal, not Gallery's.

CommentFileSizeAuthor
#12 htaccess_g2.txt2.03 KBdennys
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

profix898’s picture

I guess there is a TODO for this somewhere in the code. I will check as soon as time permits (need to setup a debug install for i18n).

profix898’s picture

Title: i18n integration » i18n integration issues

There are several issues with url handling (esp. with clean urls and url rewrite) if i18n module is installed. Lets pool all these issues here. For that I marked the following issues 'duplicate':
- search function of navigation bar doesn't work (http://drupal.org/node/185874)
- item action and i18n integration (http://drupal.org/node/186086)

profix898’s picture

Component: User Interface / Theming » Code / API
profix898’s picture

Some updates on the issues you described:

  • G2 Language switcher
    You should definitely use the Drupal search block and the Drupal language switcher instead of the G2 ones. We are talking about embedded gallery, so the master application (Drupal) should handle this stuff. The language switcher in G2 doesnt work, because Drupal overrides the language in the init() call for G2.
  • User language detection/switching
    This was indeed buggy in the latest beta of gallery.module. I've just committed a patch to correct the behavior to cvs.
  • URL Rewrite
    ... is quite difficult to handle in this context. I'm inclined to say that URL Rewrite in G2 and i18n is a "won't fix" at the moment :( although some tweaks of the gallery module code might improve the situation. I will play a bit more with it and try to explain how this all belongs together in a follow up.
profix898’s picture

Status: Active » Fixed

Looks like it can work correctly with both URL Rewrite and i18n being enabled. Can you please get the latest cvs version and give it a try? I would really appreciate if you could test 1. with/without i18n and 2. with/without gallery_menu module. Thanks in advance.

dennys’s picture

Sorry, it still doesn't work with i18n. It's ok without i18n.

btw, the datestamp of gallery.info is "1193097835", is it the newest version? File time is 2007-10-23 08:03.

profix898’s picture

The packaging script for non-releases (development snapshots) runs every 8 hours only. You can get gallery_base.inc revision 1.6.2.44 and gallery_menu.module revision 1.1.2.19 directly from cvs or wait for the snapshot to be updated.

dennys’s picture

I use cvs to get 1.6.2.44, the following is the test result:

Wihout i18n: everything is ok.

With i18n:
1. Search/Advanced search function: the same (loop to frontpage)
2. Item Action: the same (only 1st album is ok)
3. Switch language: it's ok now. Whatever I'm login or not, the language of the embeded Gallery is correct now.

I didn't install gallery_menu yet, I'm not sure what function should I test for it ?

profix898’s picture

Hmm. Not sure, but I cant get the search/action issues on my local install. There is a test site at http://scratch.profix898.de/ (user/pass: test1/test1). Could you please try there and tell me exactly what is needed to reproduce the error? Seems to work fine for me ...

dennys’s picture

I checked the configuration in Drupal, both of the 2 sites are the same. I guess mayde the reason is .htaccess file because I found your album url is http://scratch.profix898.de/en/gallery/v/754059.jpg.html, but my is http://localhost/en/v/travel/IMG_1204.JPG.html

I found you said "Your 'Show Item' rule should start with 'gallery/'. Make sure to change the URL Rewrite rule(s) accordingly." in the document, I think it means we should modify .htaccess ourselver, right ?

The following is my .htaccess added by this Gallery module, could you tell me what should I modify? I tried to change all "v/" to "gallery/v/", but it doesn't work.

<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteBase /

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d [OR]
    RewriteCond %{REQUEST_FILENAME} gallery\_remote2\.php
    RewriteCond %{REQUEST_URI} !/$
    RewriteRule .   -   [L]

    RewriteCond %{THE_REQUEST} /sitemap(\?.|\ .)
    RewriteCond %{REQUEST_URI} !/$
    RewriteRule .   /?g2_view=sitemap.Sitemap   [QSA,L]
    RewriteCond %{THE_REQUEST} /admin/(\?.|\ .)
    RewriteCond %{REQUEST_URI} !/$
    RewriteRule .   /?g2_view=core.SiteAdmin   [QSA,L]
    RewriteCond %{THE_REQUEST} /v/([^?]+)/slideshowapplet\.html(\?.|\ .)
    RewriteCond %{REQUEST_URI} !/$
    RewriteRule .   /?g2_view=slideshowapplet.SlideshowApplet&g2_path=%1   [QSA,L]
    RewriteCond %{THE_REQUEST} /d/([0-9]+)-([0-9]+)/([^/?]+)(\?.|\ .)
    RewriteCond %{REQUEST_URI} !/$
    RewriteRule .   /gallery2/main.php?g2_view=core.DownloadItem&g2_itemId=%1&g2_serialNumber=%2&g2_fileName=%3   [QSA,L]
    RewriteCond %{THE_REQUEST} /v/([^?]+)/slideshow\.html(\?.|\ .)
    RewriteCond %{REQUEST_URI} !/$
    RewriteRule .   /?g2_view=slideshow.Slideshow&g2_path=%1   [QSA,L]
    RewriteCond %{THE_REQUEST} /rss/([^\/\?]+)(\?.|\ .)
    RewriteCond %{REQUEST_URI} !/$
    RewriteRule .   /?g2_view=rss.Render&g2_name=%1   [QSA,L]
    RewriteCond %{THE_REQUEST} /srss/([0-9]+)(\?.|\ .)
    RewriteCond %{REQUEST_URI} !/$
    RewriteRule .   /?g2_view=rss.SimpleRender&g2_itemId=%1   [QSA,L]
    RewriteCond %{THE_REQUEST} /v/([^?]+)(\?.|\ .)
    RewriteCond %{REQUEST_URI} !/$
    RewriteRule .   /?g2_path=%1   [QSA,L]
</IfModule>
profix898’s picture

I found you said "Your 'Show Item' rule should start with 'gallery/'. Make sure to change the URL Rewrite rule(s) accordingly." in the document, I think it means we should modify .htaccess ourselver, right ?

This message should come up on the 'Install' tab whenever 'gallery/' is missing in the rewrite rules. I added this to ensure people having correct rewrite rules configured in G2. Maybe I should also add a link to the actual rewrite configuration screen. However you dont need to modify .htaccess manually. Simply visit the 'URL Rewrite' section in 'Site Admin' of your (embedded) Gallery2. On the 'Rules' tab you can specify the rewrite rules and G2 will automatically modify .htaccess for you. Make sure the 'Show Item' rule is set to 'gallery/v/%path%'.

dennys’s picture

FileSize
2.03 KB

I cannot modify the Rules in the (embedded) Gallery2 (I can save, but it doesn't change). But I can modify the Rules in the standalone Gallery2. But it doesn't fix the problem (the url problem in my previous comment is correct now, but search, item action still doesn't work)

Why I think this is a rewrite problem is because I checked the Apache log (I removed the browser information) and found a "301" redirect, I think the original url "/en/index.php?q=gallery" is correct just like your web, but it's redirected to the frontpage.

127.0.0.1 - - [25/Oct/2007:22:50:08 +0800] "POST /en/index.php?q=gallery HTTP/1.1" 301 20 "http://localhost/en/gallery"
127.0.0.1 - - [25/Oct/2007:22:50:09 +0800] "GET /en/gallery HTTP/1.1" 200 13699 "http://localhost/en/gallery"
127.0.0.1 - - [25/Oct/2007:22:50:10 +0800] "GET /gallery2/main.php?g2_view=imageframe.CSS&g2_frames=notebook%7Cshadow HTTP/1.1" 304 - "http://localhost/en/gallery"

My other .htaccess of Drupal is the same as the original Drupal 5.3 and the attachment is the .htaccess file of Gallery2.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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

dennys’s picture

Status: Closed (fixed) » Active

Sorry, I just downloaded gallery_base.inc,v 1.6.2.47, but it still doesn't work. So, I changed the status to active.

alexandreracine’s picture

Status: Active » Closed (fixed)

DEV version not supported anymore.

------------
Feel free to reopen but please look at the latest version first! It's probably fixed.

http://drupal.org/project/gallery

Closing (cleanup)