Author Topic: Choose language by URL  (Read 7257 times)

Offline hidepp

  • Newbie
  • *
  • Posts: 1
Choose language by URL
« 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?

Offline bobby5959

  • Jr. Member
  • **
  • Posts: 10
Re: Choose language by URL
« Reply #1 on: March 24, 2008, 04:45:33 PM »
that would be nice, I need it too!!!

ND Bobby

Offline jimcavoli

  • Jr. Member
  • **
  • Posts: 37
Re: Choose language by URL
« Reply #2 on: March 28, 2008, 07:59:49 PM »
Working on a patch, guys...

Offline jimcavoli

  • Jr. Member
  • **
  • Posts: 37
Re: Choose language by URL
« Reply #3 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):
Code: [Select]
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
Code: [Select]
$sess_user_lang = rcube_language_prop($_SESSION['user_lang']);
to this:
Code: [Select]
$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:
Code: [Select]
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 :)

Offline bobby5959

  • Jr. Member
  • **
  • Posts: 10
Re: Choose language by URL
« Reply #4 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

Offline jimcavoli

  • Jr. Member
  • **
  • Posts: 37
Re: Choose language by URL
« Reply #5 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.

Offline bobby5959

  • Jr. Member
  • **
  • Posts: 10
Re: Choose language by URL
« Reply #6 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

Offline jimcavoli

  • Jr. Member
  • **
  • Posts: 37
Re: Choose language by URL
« Reply #7 on: March 30, 2008, 09:52:34 PM »
Make sure that this step was done correctly:
Quote
Add these lines before any code in the index.php (around line 43):
Code: [Select]
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.