Roundcube Community Forum

 

Choose language by URL

Started by hidepp, February 20, 2008, 05:08:32 PM

Previous topic - Next topic

hidepp

There is any way to choose the language of Roundcube typing directly on URL, like mydomain.com/webmail/index.php?l=en?

bobby5959

that would be nice, I need it too!!!

ND Bobby

jimcavoli


jimcavoli

Alrighty, here we go:
Add these lines before any code in the index.php (around line 43):
if(isset($_GET['lang']) && $_GET['lang'] != "" && $_GET['lang'] != $_COOKIE['RCMAILUSERLANG']) {
setcookie("RCMAILUSERLANG",$_GET['lang'],time()+60*60*24);
$_GET['RCMAILUSERLANG'] = $_GET['lang'];
}
Now, in the /program/include/main.inc, change line 95 from
$sess_user_lang = rcube_language_prop($_SESSION['user_lang']);
to this:
$sess_user_lang = strip_quotes(get_input_value('RCMAILUSERLANG', RCUBE_INPUT_GPC));;
Also, add this line after line 343 so that lines 343 and 344 read as follows:
setcookie('sessauth', '-del-', time()-60);
setcookie("RCMAILUSERLANG",'-del-',time()-60);
Basically, what's happening is that a cookie is set with the language code and that is used throughout the session until they log out. Also, if &lang= something different is added at any time in the session, it switches the active language in the cookie.
Hope this helps you out!!
 --Jim :)

bobby5959

Thanks for help, got the message session expired or lost

and how should the link looking for diffrent languages?

thxs
bobby

jimcavoli

adding ?lang=XX at the login screen will switch the session's language code (XX being the language code, such as es, ru, en, etc.) until the user logs out, when the cookie is cleared and it should reset to your default after a refresh.

bobby5959

Its not working, my default language is english , but some auf my clients need german

what happend now?

on the loginscreen it change the language, but after logging in, its allways english and I cannot change the language

Maybe there is something to adjust?

thxs

Bobby

jimcavoli

Make sure that this step was done correctly:
QuoteAdd these lines before any code in the index.php (around line 43):
if(isset($_GET['lang']) && $_GET['lang'] != "" && $_GET['lang'] != $_COOKIE['RCMAILUSERLANG']) {
setcookie("RCMAILUSERLANG",$_GET['lang'],time()+60*60*24);
$_GET['RCMAILUSERLANG'] = $_GET['lang'];
}
Also make sure the others went through as well. If you could shoot me the url to your login (PM it it you'd rather), I'll try to ensure the cookie works.