Page 1 of 1

language toggle on the fly

Posted: Tue Jun 07, 2005 10:19 pm
by chepiok
My web site is available in 2 different languages. I use url rewriting to finally set a php define that contains the current language (ie. "en" or "fr").

How can I dynamically change the blog language (ie. translation of "comments", "posted by"...) ?

I've try without success to add the line: $serendipity['lang']=SMT_LANGUAGE; to the file config.inc.php of the new serendipity theme I've created for my layout.

Does someone has an idea ?

Posted: Tue Jun 07, 2005 11:17 pm
by Oliver
There is a sidebar-plugin for changing the language:

Code: Select all

Choose Language   
Allows visitors to change the frontend interface language 
Author: Garvin Hicking; version: 1.0 
But I can not say, if this is, what you are looking for, because for the moment, I can not install plugins.

Regards,

- Oliver

not really

Posted: Tue Jun 07, 2005 11:26 pm
by chepiok
The problem is that the user already has choose its language on my site. I have an url rewriting that convert /fr/ or /en/ hierachy to get the language parameter. And I want to "push" this language in the strings used by Serendipity (the serendipity_lang_en.inc.php file).

Re: not really

Posted: Wed Jun 08, 2005 10:24 am
by garvinhicking
Look at the "Language autodetection" feature of serendipity. Specifically the function "serendipity_getSessionLanguage" inside include/functions_config.inc.php and search for files calling/Accessing this function.

Have fun,
Garvin

yes but

Posted: Wed Jun 08, 2005 1:17 pm
by chepiok
there is a "strange" comment in this function : "Find a way to let plugins hook into that sequence :-)".

It' means that for the moment I cannot hook this function. Do you mean I should modified the code (easy but not very good for the future update) ?

Re: yes but

Posted: Wed Jun 08, 2005 3:28 pm
by garvinhicking
You should be able to get around this by used either the embed function of Serendipity, or by using a PHP auto_prepend directive.

Sadly until now I could not find a way to let plugins hook into the code at that point.

Probably the best way would be to modify the code directly, yes...

Regards,
Garvin

Posted: Wed Jun 08, 2005 4:44 pm
by chepiok
Ok thansk a lot. And thank you for serendipity, it's rocks!