I try to change the name of language in language switcher from Chinese, Simplified(简体中文) to 中文. Changing name in admin/config/regional/language/edit/zh-hans affects only English. So the language switcher looks like this:
en/Chinese, Simplified(简体中文)
I created a function, but on some pages (e.g. node/1), it causes errors.
function theme_preprocess_block(&$variables) {
$variables['content']['#links']['zh-hans']['title'] = '中文';
}
The error I get is the following one.
Fatal error: Call to a member function getText() on array in /var/www/mysite/core/includes/theme.inc on line 1697
How can I fix this?