I have solved myself the problem:
$customLanguage=$_GET['hl'];
$rcmail = rcmail::get_instance();
$rcmail->config->set('language', $customLanguage);
$rcmail->load_language($customLanguage);
$a=array("language"=>$customLanguage);
$rcmail->user->save_prefs($a);