Add custom stuff on main page according to language
|
ekfrasi
![]()
Joined: 2007-08-27
Posts: 10 |
Posted: Thu, 2008-05-08 16:54
|
|
Hi, and I managed to do it. for example the code (according to the codex example): what do I have to do if the language is Greek for example. |
|
| Login or register to post comments |


Posts: 9507
Are you aware of the http://codex.gallery2.org/Gallery2:Modules:multilang module?
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 613
Well, one obvious way is to include a template that has it's own private l10Domain where your own set of .mo files (compiled from your own .po files) resides, with a set of translations for your welcome text. That way you don't need to know the language in advance.
i.e. your theme.tpl has
{include file="gallery:private/mydirectory/mytemplate.tpl" l10Domain="private_mydirectory"}and your private/mydirectory/mytemplate.tpl has
{g->text text="Welcome to my gallery!"}Then you can use the Gallery language system to extract a .po file for your template, which you can duplicate and translate for different languages and finally compile to .mo files etc etc. That would all go in the private/mydirectory/locale folder, I think, if I've got my paths straight. (If I haven't, forgive me, it's late, and I'm sure someone will jump in to correct me.)
Posts: 10
Yes I am aware of that and I am using it.
My problem is that I have a flash object in my main page.
I found no way of embeding it in the description field since G2 was automatically stripping off the <object> code
My custom code is:
<object width="550" height="400">
<param name="movie" value="periods_gr.SWF">
<embed src="periods_gr.SWF" width="550" height="550">
</embed>
</object>
and I managed to put that via the {if $isItRoot} method in my Greek main page.
My difficulty is to do that in my English main page too.
OR
to find a way to embed a flash object in the <p class="giDescription"> field, so I could just do it by using the multilanguage module.
Any suggestions?
Posts: 9507
I assume you are using the language select dropdown block some place on your gallery.
in album.tpl ( you could try in theme.tpl but I didn't )
Add:
{g->callback type="core.LoadLanguageSelector"} {$block.core.LanguageSelector.language} {if $block.core.LanguageSelector.language =="fr_FR"}FRENCH{else}other Language{/if}Should do the trick. You will have to make a bunch of elseif statements if you want more.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 9507
You can detect the browsers languge settings with:
{$smarty.server.HTTP_ACCEPT_LANGUAGE}then you can truncate it with a smarty modifier and get 2 letters for a easy if statement(s):
{$smarty.server.HTTP_ACCEPT_LANGUAGE|truncate:2:""}See:
http://www.smarty.net/manual/en/language.modifier.truncate.php for more info on truncate
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 10
Thanks Dave, but...
Yes I do
Unfortunatelly It did not
My code is:
{if !empty($theme.item.description)}
<p class="giDescription">
{if $isItRoot}
<object width="550" height="400">
{g->callback type="core.LoadLanguageSelector"}
{$block.core.LanguageSelector.language}
{if $block.core.LanguageSelector.language =="en_US"}
<param name="movie" value="periods_en.SWF">
<embed src="periods_en.SWF" width="550" height="550">
{else}
<param name="movie" value="periods_gr.SWF">
<embed src="periods_gr.SWF" width="550" height="550">
{/if}
</embed>
</object>
{/if}
It works fine with the Greek, but it does not show up at all with the English
http://www.tsolozidis-collection.org
If you choose the Greek flag you will see that it displays the flash but not in the English.
By the way my album thumbnails move to the left... on IE only.
Any suggestions? OR what am I doing wrong?
Gallery version = 2.2.4 core 1.2.0.6
PHP version = 5.2.5 cgi-fcgi
Webserver = Apache/2.0.54
Database = mysqlt 4.1.11-Debian_4sarge7, lock.system=flock
Toolkits = ArchiveUpload, LinkItemToolkit, NetPBM, Thumbnail, Gd
Acceleration = none, none
Posts: 10
Good news!
It finally worked.
I needed to add a . to the description field in order for it to be displayed.
My problem now is that the language is displayed above the flash.
i.e en_US or el_GR
How do I get rif of that?
and if anyone can reproduce the IE problem...
I have no idea what is wrong.
Gallery version = 2.2.4 core 1.2.0.6
PHP version = 5.2.5 cgi-fcgi
Webserver = Apache/2.0.54
Database = mysqlt 4.1.11-Debian_4sarge7, lock.system=flock
Toolkits = ArchiveUpload, LinkItemToolkit, NetPBM, Thumbnail, Gd
Acceleration = none, none
Operati