如何使用脚本更改Roundcube中当前用户的UI语言

How to change language of UI for current user in Roundcube using a script

本文关键字:用户 UI 语言 脚本 何使用 Roundcube      更新时间:2023-09-26

我正在使用Roundcube作为webmail客户端,需要编写一个脚本来更改当前用户的UI语言。

有人知道怎么做吗?我知道有一个表users,它有一个字段language。问题在于如何使用脚本获取当前用户名。

更改语言:

// Define $customLanguage as the result of a SQL query or session
// A valid value looks like "en_GB"
$customLanguage = $_SESSION["language"]
$rcmail = rcmail::get_instance();
$rcmail->config->set('language', $customLanguage);
$rcmail->load_language($customLanguage);
$rcmail->user->save_prefs(array("language"=>$customLanguage));
//...rest of script...
相关文章: