Roundcube Community Forum

Release Support => Release Discussion => Topic started by: hidepp on February 20, 2008, 05:08:32 PM

Title: Choose language by URL
Post by: hidepp on February 20, 2008, 05:08:32 PM
There is any way to choose the language of Roundcube typing directly on URL, like mydomain.com/webmail/index.php?l=en?
Title: Re: Choose language by URL
Post by: bobby5959 on March 24, 2008, 04:45:33 PM
that would be nice, I need it too!!!

ND Bobby
Title: Re: Choose language by URL
Post by: jimcavoli on March 28, 2008, 07:59:49 PM
Working on a patch, guys...
Title: Re: Choose language by URL
Post by: jimcavoli on March 28, 2008, 09:21:24 PM
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 :)
Title: Re: Choose language by URL
Post by: bobby5959 on March 29, 2008, 03:27:43 AM
Thanks for help, got the message session expired or lost

and how should the link looking for diffrent languages?

thxs
bobby
Title: Re: Choose language by URL
Post by: jimcavoli on March 30, 2008, 04:35:59 PM
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.
Title: Re: Choose language by URL
Post by: bobby5959 on March 30, 2008, 05:43:33 PM
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
Title: Re: Choose language by URL
Post by: jimcavoli on March 30, 2008, 09:52:34 PM
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.