The gallery 2 standalone can change the language to Spanish, but integrated to drupal 5 go back to English even if Drupal is in spanish. and the language for Gallery2 is set to Spanish too.

Is there a way to solve this?

Comments

profix898’s picture

I guess you have the locale module enabled in Drupal and your default language is set to spanish!? Whats the language settings for your standalone G2? Please try to replace 'activeLanguage' => gallery_get_language($user), in gallery_base.inc (line 46) with 'activeLanguage' => 'es',. Does your embedded G2 appear in spanish now?
Just to make sure: Some strings in G2 such as image/album titles (all actual content) will stay in your previous G2 language. Only the user interface is supposed to change the language. You can set G2 standalone to spanish for comparison.

profix898’s picture

Status: Active » Closed (duplicate)

http://drupal.org/node/101423 is a similar issue, please let us continue there ... Thanks.

jgarabot’s picture

Status: Closed (duplicate) » Active

Thank you profix898, it worked great. How do I change to that other thread? I am new in this forum stuff .

profix898’s picture

StatusFileSize
new1.12 KB

How do I change to that other thread?

Dont worry, I thought you could simply post all your comments on this topic to the other issue instead.

Regarding "it worked great": You mean embedded G2 is switching to spanish if you use the snippet? That means there is a bug in gallery_get_language(). It would be really helpful if you could make some more changes and post back the results. I cant reproduce this issue on my install.

1. What PHP version are you running?
2. Make sure you are using the latest version of the gallery module.
3. Please apply the patch (attached to this post), browse to your main embedded gallery page (/?q=gallery) and post or mail me the output.

In case you dont know how to apply patches read http://drupal.org/node/60108 or simply copy/paste the few lines into gallery_base.inc.

jgarabot’s picture

Gallery version = 2.1.2 core 1.1.0.2
PHP version = 4.4.1 apache
Webserver = Apache/1.3.34 (Unix) PHP/4.4.1 mod_ssl/2.8.25 OpenSSL/0.9.7a FrontPage/5.0.2.2635
Database = mysql 4.0.26, lock.system=flock
Toolkits = ArchiveUpload, Exif, Ffmpeg, Getid3, NetPBM, SquareThumb, Thumbnail, Gd
Acceleration = none, none
Operating system = Linux webster.worldispnetwork.com 2.6.9-42.ELsmp #1 SMP Wed Jul 12 23:27:17 EDT 2006 i686
Default theme = matrix
Locale = en_US
Browser = Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1

http://www.eloasisrd.org/?q=gallery&g2_0=gallery&g2_fromNavId=xb6eb5aab

uid>0) ? $user->uid : '';
$params = array('embedUri' => $embedUri,
'g2Uri' => $g2Uri,
'loginRedirect' => url('user/login', null, null, true),
'activeUserId' => $active_id,
'activeLanguage' => 'es',
'fullInit' => $full);

I hope this helps

profix898’s picture

I hope this helps

Actually it would be more helpful, if you'd apply the patch and send me the results ... To see how gallery_get_language() works on your configuration could help to fix that function!

jgarabot’s picture

"Actually it would be more helpful, if you'd apply the patch"

I would really like to help, but I read the "how to apply a patch", and I really do not understand, since I am not very technical. if you could tell me where to go in my hosting account to do that step by step I will be glad to do it.

profix898’s picture

StatusFileSize
new6.92 KB

I read the "how to apply a patch", and I really do not understand

That shouldnt be the problem. Attached is a ready-patched version of gallery_base.inc (you can simply remove the .txt at the end). Replace the file in your install with the attached one and browse to your gallery page. You should see some debug variables printed. Restore the original file, send me the debug output and hope it will help to fix this issue. Thanks a lot for your help.
(You can also mail (http://drupal.org/user/35192/contact) the output, if you dont want to post it here.)

jgarabot’s picture

StatusFileSize
new5.96 KB

"That shouldnt be the problem."

I attached the patch results. I hope this is what you need.

profix898’s picture

Category: support » feature

Thanks again jgarabot! That is what I needed, yes! If I got this right from the debug output you are using a custom language code ('esl/spa es'). Is there any reason to no use the Drupal buildin "Spanish (es)"? Gallery2 only supports the ISO 639-1 language codes (alias alpha-2 code) AFAIK. See http://www.loc.gov/standards/iso639-2/php/code_list.php for details. What means language switching for embedded G2 works nicely with Drupal buildin language codes, but not with your custom one.

I will write a regexp based filter to extract the alpha-2 code or translate alpha-3 codes accordingly, but I doubt there will be support for mixed codes (such as yours) ...

kiz_0987’s picture

Good pick up. The string regexp is a great idea. It would be useful to provide an error message if the language code will not work for Gallery2 (ideally Gallery2 embed code would have done this) but perhaps something is possible in gallery.module. One issue though will be turning off the error log (or watchdog) once you know there is a language arror but choose not to fix it (otherwise a log will occur on every gallery page view).

jgarabot’s picture

I am using the Drupal build in "Spanish (es), I just imported it as a custom language and wrote that code name by mistake, because I did not understood very well the process when I first installed it.

jgarabot’s picture

Is there a way I can change the code to (es)?, I tried importing Spanish again and the translation is only 69%.

profix898’s picture

There is no UI to do that in Drupal, but you can make the changes to the database manually. Try to run the following 2 queries:

UPDATE `locales_meta` SET `locale` = 'es' WHERE `locale` = 'esl/spa es' LIMIT 1;
UPDATE `locales_target` SET `locale` = 'es' WHERE `locale` = 'esl/spa es';

You should check the language codes again and make a backup of your database tables!

jgarabot’s picture

I imported the Spanish again this time with the right code and added the 4.7 Spanish. now it is working fine. with the (es)

dsp1’s picture

i am glad i found this post. i did not know and and it seems there are many posts with people struggling with this issue on drupal and gallery forums.

As far as I can tell, correct me if i am wrong, the USER must change the language in the account to see the language in Gallery2. The anonymous user, drupal language switching or gallery2 language selector (embedded) will not work. is this a bug? is there a fix?

profix898’s picture

Version: 5.x-1.x-dev » master

Simple regexp added for Drupal-5--2 branch. We will need to check this again for Drupal-6, because it will support full RFC4646 language codes ...

profix898’s picture

Version: master » 5.x-2.x-dev
Component: User interface » User interface / Theming
Status: Active » Fixed

Looks like this is a reasonable solution. Marking fixed as it is part of the 5--2 branch.

Anonymous’s picture

Status: Fixed » Closed (fixed)