function admin_language_init in Administration Language 6
Implementation of hook_init().
File
- ./
admin_language.module, line 78 - Makes sure all admin pages are displayed in the preferred language of the administrator.
Code
function admin_language_init() {
if (user_access('display admin pages in another language') && variable_get('language_count', 1) > 1) {
global $_admin_language;
$languages = language_list('enabled');
$languages = $languages[1];
$admin_language = variable_get('admin_language_default', 'en');
$_admin_language = $languages[$admin_language];
if (_admin_language_switch_language()) {
global $user;
if (isset($user->admin_language)) {
switch ($user->admin_language) {
case 'admin':
// nothing to do, use default value of $admin_language
break;
case 'default':
$default = language_default();
$admin_language = $default->language;
break;
default:
if (isset($languages[$user->admin_language])) {
$admin_language = $user->admin_language;
}
}
}
global $language;
$language = $languages[$admin_language];
}
}
}