mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-12 21:00:21 +00:00
I18N: Allow installing new translations when changing the user locale on the profile page.
Up until now, new translations could only be installed via Settings -> General. When editing the user profile, one could only select locales that were already installed. This change allows also installing new translations if the editing user has the necessary capabilities. Props barryceelen, johnbillion, ocean90, swissspidy. Fixes #38664. git-svn-id: https://develop.svn.wordpress.org/trunk@55099 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -119,7 +119,13 @@ function edit_user( $user_id = 0 ) {
|
||||
} elseif ( '' === $locale ) {
|
||||
$locale = 'en_US';
|
||||
} elseif ( ! in_array( $locale, get_available_languages(), true ) ) {
|
||||
$locale = '';
|
||||
if ( current_user_can( 'install_languages' ) && wp_can_install_language_pack() ) {
|
||||
if ( ! wp_download_language_pack( $locale ) ) {
|
||||
$locale = '';
|
||||
}
|
||||
} else {
|
||||
$locale = '';
|
||||
}
|
||||
}
|
||||
|
||||
$user->locale = $locale;
|
||||
|
||||
Reference in New Issue
Block a user