Hi,
Site admin can install needed language file for WordPress temporally changing site language at the Settings->General page. (Change language, update settings, change language back).
WordPress offers special filter ‘locale’, which allows to automatically change language according your own conditions. You may use code below as a starting point, change ‘author’ role to your own:
// Change site language for a role
add_filter( 'locale', 'change_site_lang_for_role', 10, 1 );
function change_site_lang_for_role( $locale ) {
if ( !is_user_logged_in() ) {
return $locale;
}
$user = wp_get_current_user();
if ( !is_array( $user->roles ) ) {
return $locale;
}
if ( in_array('author', $user->roles ) ) {
$locale = 'de_DE';
}
return $locale;
}
// end of change_site_lang_for_role()