Add custom stuff on main page according to language

ekfrasi
ekfrasi's picture

Joined: 2007-08-27
Posts: 10
Posted: Thu, 2008-05-08 16:54

Hi,
I checked the codex :
Gallery2:How to add custom stuff on main root page

and I managed to do it.
My problem is, How do I display a different thing when the language changes?

for example the code (according to the codex example):
{if $isItRoot} Hi! Welcome in my gallery! {/if}

what do I have to do if the language is Greek for example.
How do I make this:
{if $isItRoot} Hi! Welcome in my Greek Gallery! {/if}

Login or register to post comments
floridave
floridave's picture

Joined: 2003-12-22
Posts: 9507
Posted: Thu, 2008-05-08 21:28

Are you aware of the http://codex.gallery2.org/Gallery2:Modules:multilang module?

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

Login or register to post comments
alecmyers

Joined: 2006-08-01
Posts: 613
Posted: Fri, 2008-05-09 00:13

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.)

Login or register to post comments
ekfrasi
ekfrasi's picture

Joined: 2007-08-27
Posts: 10
Posted: Sun, 2008-05-11 16:13
floridave wrote:
Are you aware of the http://codex.gallery2.org/Gallery2:Modules:multilang module?

Dave

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?

Login or register to post comments
floridave
floridave's picture

Joined: 2003-12-22
Posts: 9507
Posted: Sun, 2008-05-11 17:31

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

Login or register to post comments
floridave
floridave's picture

Joined: 2003-12-22
Posts: 9507
Posted: Sun, 2008-05-11 17:40

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

Login or register to post comments
ekfrasi
ekfrasi's picture

Joined: 2007-08-27
Posts: 10
Posted: Tue, 2008-05-13 14:54

Thanks Dave, but...

floridave wrote:
I assume you are using the language select dropdown block some place on your gallery.
in album.tpl

Yes I do

floridave wrote:
(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

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

Login or register to post comments
ekfrasi
ekfrasi's picture

Joined: 2007-08-27
Posts: 10
Posted: Tue, 2008-05-13 15:00

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

Login or register to post comments