Need a PHP variable for active language code
op351net
Joined: 2009-10-04
Posts: 8 |
Posted: Sun, 2009-10-25 12:30 |
I'm using a third-party PHP script in Gallery and I need to define in that script a variable representing the active language code selected for Gallery (in my case 'pt_PT' or 'en_US'). Usually there is something like $locale, $lang, etc but I can't find one in Gallery scripts to use it in the third-party script. I've tried $_SESSION['language'] and similar but doesn't work. Any ideas, please? --- |
|
Posts: 8339
This is how I'm doing the same in my geeklog -> Gallery2 bridge:
Hope this helps.
-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2
Posts: 8
Maybe I was not clear enough but I just need to know in my script what language is Gallery running on. With that I intend to place some conditions in my script according to Gallery active language.
Thanks anyway for your reply. Was really fast
---
Roaming... free the image!
http://gallery.op351.net/
Porto - PORTUGAL
Posts: 8339
http://gallery.menalto.com/apidoc/GalleryCore/Classes/Gallery.html#methodgetActiveLanguageCode
-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2
Posts: 8
... and what would be the PHP code to insert in my script? This is because every trial I've made have resulted in
Fatal error: Using $this when not in object context in http://gallery.op351.net/modules/core/classes/Gallery.class on line 561
Thanks
---
Roaming... free the image!
-Gallery v2.3
-Theme 'Carbon'
http://gallery.op351.net/
Porto - PORTUGAL
Posts: 8339
Strange that you are using gallery as the master app, we usually embed gallery in the third party app. Easier I belive.
-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2
Posts: 8
No success! 'GalleryCoreApi' has not the function you refer to and other classes (like 'GalleryTranslator') give me empty arrays.
Regarding 'embeding', I'm rather for natural beauty of Gallery which is really a great job. Only the translation/localization still need a gooood work out...
Thanks.
---
Roaming... free the image!
-Gallery v2.3
-Theme 'Carbon'
http://gallery.op351.net/
Porto - PORTUGAL
Posts: 8339
Well, its a method of Gallery.class which should be available via GalleryCoreApi but is certainly available via:
list($ret, $lang) = $gallery->getActiveLanguageCode();
of course I'm assuming you're connected to $gallery via GalleryEmbed or other.
Also you can get the language of the current user by loading the user and using: $user->getLanguage();
-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2
Posts: 8
My Gallery is not embedded! I'm just using it on a stand-alone mode but I use a PHP script INSIDE Gallery for a particular function. Even being inside Gallery nothing is working in that script to get the active language code available to program some conditions!!
Thanks anyway. You've been great.
POST DAYS OF INVESTIGATION: for those wanting to include a PHP script with current language dependency in a Gallery template file (.tpl) there it goes a possible solution:
- place in the '.tpl' file where you call an external PHP script the following code (or similar):
Might not be hi-tech but it works for me!
---
Roaming... free the image!
Gallery v2.3 | Theme 'Carbon'
http://gallery.op351.net/
Porto - PORTUGAL